-->
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.  [ 1 post ] 
Author Message
 Post subject: Aggregate function in 3.2 - Criteria - Still Returns Integer
PostPosted: Thu May 24, 2007 5:17 pm 
Beginner
Beginner

Joined: Thu May 18, 2006 2:58 pm
Posts: 28
I saw that the Hibernate3 Migration Guide for 3.2 http://www.hibernate.org/250.html#A44 states that the return types for aggregation (count, sum, avg) functions have changed (The new type rules are described at http://opensource.atlassian.com/projects/hibernate/browse/HHH-1538).

I have found with a Criteria query (see code below), applying a projection to the query, and specifying uniqueResult, the return type is still Integer?

1. Is this correct?
2. If not, can someone explain?
3. If correct, shouldn't it all be consistent (In this case return Long)?

Thanks.

Matt

Returns Integer (why not Long?)
Code:
Example exampleLightbox = Example.create(lightbox).ignoreCase();
Integer count = (Integer) session.createCriteria(ELightbox.class)
         .setProjection(Projections.rowCount()).add(exampleLightbox)
            .add(
               Restrictions.eq("customerId", lightbox
                  .getCustomerId())).uniqueResult();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.