Hello,
I can't find out an answer to very simple question:
How to fetch collection eagerly by using a separate select, if I want to use Criteria query.
I would expect, that this code should do it, but it doesn't work.
Code:
DetachedCriteria crit = DetachedCriteria.forClass(Parent.class);
crit.setFetchMode("children", FetchMode.SELECT);
crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
In spite of the fact, that in doc of FetchMode.SELECT is writen: "Fetch eagerly, using a separate select.", collection of children isn't eagerly fetched and I still recieve LazyInicializationException.
Thanks in advance.