I am sorry I don't have the time to compile a testcase :-(. If you don't have the time to look into it, so be it.
We used the "newer"
Code:
public Criteria createCriteria(java.lang.String associationPath, int joinType)
methode on the Criteria object.
When we set the joinType to a LEFT OUTER JOIN the collection with the details records got not properly loaded. I traced through the sourcecode and found that in the process of loading the stuff the collection is set to "initialized" already. In the case of the usuale INNER JOIN the collection is not initialized after the query and gets properly fetched at the first access.
Example:
Foo references Bar with a one-to-many relation.
Criteria written as HQL:
Code:
Select f from Foo f INNER JOIN Bar b on f.bars=b with b.prop = 'value'
-> f.bars is properly initialized at access
Code:
Select f from Foo f LEFT OUTER JOIN Bar b on f.bars=b with b.prop = 'value'
-> f.bars only contains the one entry that fullfills the where part
These queries are formulated with the
Criteria API, not in HQL as written here.
Tested with Hibernate 3.2cr2 and cr4.