-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help with Group by operation ... URGENT PLSS
PostPosted: Sat Jun 20, 2009 5:49 pm 
Newbie

Joined: Sat Jun 20, 2009 5:43 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.