-->
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: Issue with Projections.min() on empty table
PostPosted: Thu Oct 01, 2009 6:20 am 
Newbie

Joined: Wed Jul 23, 2008 5:35 am
Posts: 2
Hi all,

I'm trying to make following query to hibernate:
Code:
Criteria criteria = session.createCriteria(MyEntity.class);
criteria.setProjection(Projections.projectionList()
.add(Projections.min("revision"), "min")
.add(Projections.rowCount(), "rows")
);
List list = criteria.list();

I know that there are no instances of MyEntity in db. Not a single entity was created before I executed the query. The list() method returns me {{0, 0}}.
Does anybody know why the first element is 0 (zero)? It should be null because the table MyEntity is empty.
revision is int nullable property. When I make the same request using createSQLQuery it returns null for min(revision)
Hibernate version is 3.2.6.ga.

Thank you.


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.