You may specify association fetching semantics at runtime using
setFetchMode()
.
List cats = sess.createCriteria(Cat.class) .add( Restrictions.like("name", "Fritz%") ) .setFetchMode("mate", FetchMode.EAGER) .setFetchMode("kittens", FetchMode.EAGER) .list();
This query will fetch both mate
and kittens
by outer join. See Section 19.1, “Fetching strategies” for more information.