dear all,
I can't make Fetch Profiles work with HQL.
I used it succesfully with the (old) native Criteria and with session.get() API, but not with HQL.
is it normal ?
thanks
the following does not work :
Code:
@Override
public List<Country> findAllFetchProfileCities() {
getSession().enableFetchProfile("countryCities");
boolean enabled = getSession().isFetchProfileEnabled("countryCities");
List<Country> list = getSession().createQuery("from Country").list();
enabled = getSession().isFetchProfileEnabled("countryCities");
return list;
}
the following works OK :
Code:
@Override
public Country findOneFetchProfileCities(Long _id) {
getSession().enableFetchProfile("countryCities");
Country c = (Country) getSession().get(Country.class, _id);
return c;
}
@Override
public List<Country> findAllCriteriaFetchProfileCities() {
getSession().enableFetchProfile("countryCities");
return getSession().createCriteria(Country.class).list();
}