views:

27

answers:

0

I have a situation where entity A contains a set of entity B. Each entity B contains one entity C. Each entity C has a list of entity D's. I want all A's that meet some criteria but I also want the D's eagerly loaded (mapping file lazily loads them). I have code similar to the following

Criteria aCriteria = session.createCriteria(A.class);
// Restrictions on aCriteria
aCriteria.setFetchMode("b", FetchMode.JOIN);

Criteria cCriteria = aCriteria.createCriteria("b").createCriteria("c");
c.setFetchMode("d", FetchMode.JOIN);

However, this does not appear to overwrite the mapping of entity C's D's. They are still lazily loaded.

Thoughts?