The following works: String hql = "select new map(log as log, cur as cur) " + " from db2.co99blh.Dtnamelog log, " + " db2.co99blh.Dtname cur " + " where " + " (log.id.mlid = cur.id.mid and " + " log.id.mlgroup = cur.id.mgroup) " + " order by log.mlco";
But when I try to change the above to use a left join. nullorg.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44) org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38) org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1358) org.hibernate.loader.criteria.CriteriaQueryTranslator.getPathEntityName(CriteriaQueryTranslator.java:204) org.hibernate.loader.criteria.CriteriaQueryTranslator.createCriteriaEntityNameMap(CriteriaQueryTranslator.java:191) org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:81) org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:58) org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550) org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) utilities.ListChangedCompanyNames2.query(ListChangedCompanyNames2.java:82)
Right now I was trying with a Criteria, so here is the code from that: Criteria crit = session.createCriteria("db2.co99blh.Dtnamelog", "log"); crit.createAlias("Dtname", "cur", Criteria.LEFT_JOIN); crit.add(Restrictions.eqProperty("log.id.mlid", "cur.id.mid")); crit.add(Restrictions.eqProperty("log.id.mlgroup", "cur.id.mgroup")); crit.setMaxResults(resultsPerPage); crit.setFirstResult(startRecord); list = crit.list(); //Exception thrown here (ListChangedCompanyNames2.java:82)
I've seen some reference that I might need to do something in the mapping files to enable left joins... I have no idea, as long as I don't use joins everything works fine, but in this case I definitely need all the elements in the left table and generating a cross product bothers me.
|