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.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to