Hi
I'm trying to initialize a one-to-many collection eagerly using a Criteria Object. It works all right when I just do this:
Criteria criteria = getSession().createCriteria(CallApprovable.class);
criteria.add(Expression.eq("active", new Boolean(true)));
criteria.setFetchMode("workflowEntry.currentSteps", FetchMode.EAGER);
criteria.list();
Problem is, when I append this expression, hibernate does not initialize the collection anymore:
if (callApprovableCriteria.getStepArray() != null && callApprovableCriteria.getStepArray().length > 0)
{
criteria.createCriteria("workflowEntry").createCriteria("currentSteps").add(Expression.in("stepId", callApprovableCriteria.getStepArray()));
}
I didn't know that adding criterias could change the behaviour of collection initialization. Am I right ?? what can I do to eagerly initilize the collection ?
Thanks.
Hibernate version:
2.1.8
|