-->
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: Projection count returning Integer instead of Long
PostPosted: Thu Oct 21, 2010 3:41 pm 
Newbie

Joined: Tue Aug 11, 2009 6:28 pm
Posts: 2
Hi, I'm trying to return the number of rows matching certain criterias on a very large table. The projections.count("id") works nice, but it returns an Integer. The table has much more rows than the max integer value. In this situation, what is a possible alternative using hibernate to get the long value? Also, why does it return an Integer? Wouldn't be correct to return a Long?


Top
 Profile  
 
 Post subject: Re: Projection count returning Integer instead of Long
PostPosted: Wed May 22, 2013 11:59 am 
Newbie

Joined: Wed May 22, 2013 11:45 am
Posts: 1
It would seem judging by the hibernate 3.3 to 3.5 migration guide that the count and countDistinct projections now return longs.

https://community.jboss.org/wiki/HibernateCoreMigrationGuide35

Quote:
Numeric aggregate Criteria projections now return the same value type as their HQL counterparts. As a result, the return type from the following projections in org.hibernate.criterion have changed:
"count" and "count distinct" projections now return a Long value (due to changes in CountProjection, Projections.rowCount(), Projections.count( propertyName ), and Projections.countDistinct( propertyName )).


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.