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
|