Hi,
How do you create an inner join to the same table using Criteria.createAlias or Criteria.createCriteria?
Basically, I have tried this:
Code:
ProjectionList pList = Projections.projectionList();
pList.add(Projections.groupProperty("orderBaseId"));
session = HibernateSessionFactory.currentSession();
Criteria crit = session.createCriteria(QuoteMaster.class);
Criteria c = crit.createCriteria("QuoteMaster", CriteriaSpecification.INNER_JOIN);
c.setProjection(pList);
But I get this error:
Code:
could not resolve property: this
Basically, I am trying to replicate this SQL query but I do not want to use the in keyword, I want to use an inner join just like in my query here:
Code:
SELECT * FROM
sys_quote_master AS g1
INNER JOIN (SELECT order_base_id, order_id
FROM sys_quote_master where order_base_id="010313-6063" group by order_base_id order by order_id asc) AS g2
ON g2.order_id = g1.order_id;