Hi Guys,
When I use the setFetchMode in a LAZY association, the hibernate generate the
select with LEFT_OUTER_JOIN join strategy and return the expected data (the collection is loaded).
If I use the setFetchMode in a LAZY association and I create an alias in same
association forcing the INNER_JOIN, the select will be generated using the INNER_JOIN,
but the collection will not loaded.
Code:
...
Criteria c = session.createCriteria(Client.class);
c.createAlias("contact", "c");
c.setFetchMode("contact", FetchMode.JOIN);
c.add(Restrictions.eq("c.name", "Paul"));
...
In this case, the query will be filtered by contact name, but the collection will be not loaded.
The hibernate loads the collection only if the join strategy is equals LEFT_OUTER_JOIN,
Why?
Debuging the hibernate code, I saw that the select is running as expected, but
there is a condition (JoinWalker.java:885) that load the collection only if the join
strategy is equals LEFT_OUTER_JOIN.
* Hibernate 3.3.2 and 3.6.10
Tks!