Left join using hibernate criteria

you can try the following

Criteria criteria = session.createCriteria(Issues.class);
criteria.setFirstResult(from);
criteria.setMaxResults(size);
criteria.setFetchMode('parent.child', FetchMode.JOIN);
criteria.add(Restrictions.eq("status", "Escalate To");
List<Issues> list= criteria.list();

here parent is the property name in Issues.java and child is the property in IssueTracker.java.


Well,

follow one sample...

Criteria crit = session.createCriteria(Issues.class);
crit.createAlias("otherClass", "otherClass");
crit.add(Restrictions.eq("otherClass.status", "Escalate To"));
List result = crit.list();

I think so this can to help!!


Try this out because this worked for me

Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Issues.class, "issues");
criteria.setFetchMode("issues.issuetracker", FetchMode.JOIN);
criteria.createAlias("issues.issuetracker", "issuetracker");
criteria.add(Restrictions.eq("status","Escalate To"));
List list = criteria.list();
return list;