I am a beginner to hibernate . I am having trouble in using GROUP-BY operator using detached criteria queries.
I have two tables:
1) Transactions: {ID, present, paymentRecord}
2) Records: { ID, name, content}
Transactions and records have many to one relation ship
I want to select all the transactions which have present = false and grouped by paymentRecord
I used the following for that:
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Transactions.class); detachedCriteria.add(Restrictions.eq("present",false)); detachedCriteria.setProjection(Projections.projectionList().add(Projections.groupProperty("paymentRecord"))); List results = getHibernateTemplate().findByCriteria(detachedCriteria); return results; }
I expected it to return a list of (list of transactions), however it was returning list of paymentRecords, Any idea how to solve this?
Any help will be highly appreciated..
Thank you
|