Red Hat Training
A Red Hat training course is available for Red Hat JBoss Web Server
16.5. Dynamic association fetching
You can 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 20.1, “Fetching strategies” for more information.