-->
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.  [ 2 posts ] 
Author Message
 Post subject: Group by Problem in HQL
PostPosted: Thu Apr 08, 2004 8:14 am 
Newbie

Joined: Sun Nov 30, 2003 10:09 am
Posts: 14
Hello Every body,
Here is my simple HQL

select p.id, sum(sl.quantity),sum(sl.bookedQuantity) from DepotDTO
d,DepotInventoryDTO di,StoreDTO s inner join s.storeLines sl, ProductDTO p
where d = di.depot and d.code = 'DSD' and
di = s.inventoryHouse
and sl.product = p group by p.id

It works fine. Now i want to execute the following HQL (Slight different except selecting p.id
I select whole p object and group by p)
:

select p, sum(sl.quantity),sum(sl.bookedQuantity) from DepotDTO
d,DepotInventoryDTO di,StoreDTO s inner join s.storeLines sl, ProductDTO p
where d = di.depot and d.code = 'DSD' and
di = s.inventoryHouse
and sl.product = p group by p

This HQL does not work. It generates exception asking every properties of product in group by clause .

so If I write the HQL following way it runs:
[b]
select p, sum(sl.quantity),sum(sl.bookedQuantity) from DepotDTO
d,DepotInventoryDTO di,StoreDTO s inner join s.storeLines sl, ProductDTO p
where d = di.depot and d.code = 'DSD' and
di = s.inventoryHouse
and sl.product = p group by
p.code,p.commercialName,p.id,p.genericName,
p.description,p.registrationDate,p.productGroup,
p.productType,p.status,p.strength,p.unitConfig


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 08, 2004 8:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See the FAQ - all fields need to be listed. For the moment the short cut is not supported.


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