Version: hibernate-core-3.5.6
Ok, so here's the deal (and as a disclaimer it's quite possible that this may be due to a lack of understanding on my part)... I'm trying to select a mapped entity three levels deep in my object graph. The second level entity is aliased and qualified with a left outer join in my HQL statement.
Code:
select child1.child2 from Parent p
left join p.child1 as child1
which results in something along the lines of:
Code:
select child2_.col1, child2_.col2
from tblParent parent_
left outer join tblChild1 child1_ on child1_.id = parent_.id
inner join tblChild2 child2_ on child2_.id = child1_.child2Id
I'm aware of the nuances of using an implicit join in HQL, but wouldn't expect this to apply if the direct parent (child1 in this case) is explicitly qualified with a left outer join. As you have probably inferred at this point, this is filtering my results to include only those with non-null values for child2. I'm most likely missing something obvious here, but unfortunately the solution has proven to be most elusive thus far. For the sake of specificity, child1 is a one-to-one from the root object (Parent) and child2 is a many-to-one from child1.
It's also worth mentioning that I'm building the HQL dynamically for reporting purposes. The code reads the property path from an enum which represents a field that can be included in a report. Ideally, we would like to be able to simply add an additional enum for inclusion in the report without having to modify the DAO code responsible for building the query.
Any ideas?