-->
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: HIA pg. 275 error?
PostPosted: Sun Jun 05, 2005 6:28 pm 
Newbie

Joined: Sun Jun 05, 2005 6:03 pm
Posts: 1
I'm having difficulty with the HQL "select new" constructor and the aggregation functions available with reporting queries. Specifically, I'm wondering what datatypes Hibernate returns for COUNT, AVG, etc.

On HIA pg. 275 the text reads:

If we define a class called ItemBidSummary with a constructor that takes a Long, a String, and an Integer, we can use the following query:

select new ItemBidSummary( bid.item.id, count(bid), avg(bid.amount) )...

The datatypes listed in the text are inconsistent with what I would expect out of those aggregations.

Also, I've searched the CaveatEmptor sample code for the ItemBidSummary class to see what the constructor was actually doing, and can't find any such definition. Am I looking in the wrong place? Thanks,

-Scott


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 11:50 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It needs a Long, a STring, and an Integer, and that is what I would expect from this query. Please follow up on the Hibernate reference and in the regular user forums if you have problems with this. Keep in mind that there were some changs in Hibernate3 to allow aggregate functions in this operator, it didn't even work when we wrote the book. We were hoping to include it in a later release before the book was out but it didn't work.


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.