-->
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.  [ 3 posts ] 
Author Message
 Post subject: Group by object does not work
PostPosted: Tue May 04, 2004 5:00 am 
Newbie

Joined: Wed Oct 08, 2003 7:42 pm
Posts: 18
I have been trying to group by an object as in the following example code from the reference page.

select cat, count( elements(cat.kittens) )
from eg.Cat cat group by cat


The sql that is generated only ever groups by the id of the object instead of each of the fields selected to create the object. Obviously this causes sql exceptions stating that e.g. cat.name must be grouped by or used in an aggregate function.

Is there something that I am likely missing? I can't seem to find that anyone else is having this problem. When looking at the code for the GroupByParser, however, I noticed a comment that said that it was basically just a refactor of OrderByParser. It would make sense for the OrderByParser to only care about the id of the object, but this is not the case for order by.

Any help would be appreciated.

Thanks in advance,
Scott


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 04, 2004 5:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is a known issue : http://www.hibernate.org/74.html#A14 - it might someday get "fixed".


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 10:24 am 
Newbie

Joined: Fri Feb 20, 2004 12:23 pm
Posts: 10
I'd would very much like to see this issue fixed. My HQL with the group by clause looks a little ugly right now.
(BTW, the url to the specific FAQ is http://www.hibernate.org/74.html#A12 )


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.