Hi
How can I write following SQL
Code:
SELECT
m.match_type,
count(m.match_type)
cat.description,
loc.oid
FROM
USER_MATCH m,
RECORD rec,
CATEGORY cat,
LOCATION loc
WHERE
m.record_oid = rec.oid and
rec.category_oid = cat.oid and
rec.location_oid = loc.oid
group by m.match_type, cat.description, loc.oid
in hibernate criteria?
I have attempt it as following but I'm getting
subquery expressions not allowed here error.
Code:
Criteria criteria = hibernateTemplate.getSessionFactory().getCurrentSession().createCriteria(Match.Class);
criteria.createAlias("record", "record");
criteria.createAlias("category", "category");
ProjectionList projList = Projections.projectionList();
projList.add(Projections.groupProperty("record.categoryId"));
projList.add(Projections.groupProperty("record.locationId"));
criteria.setProjection(projList);
thanks in advance :)