From: Sunny <shi...@ya...> - 2006-07-22 09:06:02
|
I am using a named query in my .hbm file: <query name="queryName"> <![CDATA[ select itemModel.productId , count(inventoryItemModel.itemId) from ItemModel itemModel, InventoryItemModel inventoryItemModel where inventoryItemModel.itemId = itemModel.itemId and inventoryItemModel.status = 1501 and itemModel.productId = ? group by itemModel.productId, itemModel.itemId ]]></query> This is working fine.However i need to write an outer query to get the minimum count. This is what I want: select productId, min(ABC) from <query name="queryName"> <![CDATA[ select itemModel.productId , count(inventoryItemModel.itemId) ABC from ItemModel itemModel, InventoryItemModel inventoryItemModel where inventoryItemModel.itemId = itemModel.itemId and inventoryItemModel.status = 1501 and itemModel.productId = ? group by itemModel.productId, itemModel.itemId ) group by facility_id, product_id ]]></query> Giving alias ABC throws error "Error in named query".Is there any other way to specify an alias ? Please help me to solve this.Thanks in advance. -- View this message in context: http://www.nabble.com/giving-alias-in-Named-Query-tf1983665.html#a5444429 Sent from the Hibernate forum at Nabble.com. |