Joining to association twice using criteria causes: NHibernate.QueryException: duplicate association path
Description
Test case to follow
Environment
Activity
Move minor and trivial bugs to 5.0.1 version
We need to join to the same collection twice for reporting queries. Our users want to see the most recent child matching some criteria, and the most recent child matching some other criteria in the same row. This is easy enough to do in SQL, but we can't use that because of the complex criteria we use to build our reports.
I'm added criteria alias for unique identification join statement. This makes it possible to declare complex expressions join.
Deviations in the standard behavior of the rest of the functionality I hadn't noticed.
It's difficult to show real-world, i'm not at liberty to post my source code or even talk about the nature and relationships of my domain model.
I can tell you that I need to join to the same collection twice because
I need to build a dynamic query that flattens a one-to-many into one row (hence criteria api)
The query will need a left-outer-join to the collection 0, 1 or perhaps many times depending on user preference
Each join is designed to provide one property to be projected on and will be one-to-one with the root entity of the query
The criteria API does not support joining to unrelated entities (if it did I would not have this problem)
I am interested in adding the feature but it appears to be a tricky task.
Why would you need to join same collection twice? Can you show the real-world scenario?