-->
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.  [ 4 posts ] 
Author Message
 Post subject: Doubt about group by using Criteria
PostPosted: Mon Oct 15, 2007 7:44 am 
Newbie

Joined: Fri Mar 02, 2007 3:26 pm
Posts: 4
Hi all !

I have a doubt about a criteria that I did.

This is the code that I need.

select
sum(table_name.field_1)
from
Table As table_name
group by
table_name.field_2

When I use the "group by" clause, NHibernate put the field_2 on my "Select".

I just want like above.

Thanks

Thiago (from Brazil)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 15, 2007 12:32 pm 
Newbie

Joined: Fri Mar 02, 2007 3:26 pm
Posts: 4
Anybody can help me please ?

Nobody understand my doubt ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 8:20 am 
Newbie

Joined: Mon Sep 17, 2007 11:42 pm
Posts: 16
Location: Auckland, New Zealand
I made a issue / patch for something like this in the Criteria API for Hibernate Core. See if you can take something from it?

Criteria api does not allow a groupProperty to _NOT_ be included in the selected columns
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2893

Basically it allows you to specify a groupProperty like this:
Code:
Projections.groupProperty("id.variableId",true)

Javadoc:
Quote:
@param excludeFromSelect
indicates not to include this parameter in the select clause,
and _only_ in the GROUP BY clause.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 9:42 am 
Newbie

Joined: Fri Mar 02, 2007 3:26 pm
Posts: 4
Ok ....

I understood it. Thanks by your help.

Bye.

Best regards.

Thiago (from Brazil)


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

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.