Hibernate version:
3.0.5
I'm trying to use the Criteria to override lazy initialization for a query.
Is there a way to add criteria to a query? something starting along the lines of the following code
Code:
Query query = session.getNamedQuery("fromJobQueueList");
query.setProperties(jql);
session.createCriteria(jql.getClass()).setFetchMode("JobQueueSysins", FetchMode.JOIN);
I'm trying to use the criteria because I don't want to have lazy="false" declared for the entire class and I don't want to use Hibernate.initialize because that gets me the whole N+1 problem.
... or am I generating too much trouble for myself and go ahead and just initialize lazy="false" for the class in the hbm file?