-->
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: createCriteria outside container - 0 results
PostPosted: Sun Dec 25, 2005 11:55 am 
Beginner
Beginner

Joined: Tue May 03, 2005 11:45 pm
Posts: 43
Hibernate version:
3.1 rc2

Code between sessionFactory.openSession() and session.close():

List results = session.createCriteria(Zipcode.class)
.add(Restrictions.ne("type", "M")) // no military
.add(Restrictions.eq("zip", "30126"))
.list();


Name and version of the database you are using:

mysql 5


For some reason when I try and test my dao objects outside the container (Tomcat) I get 0 results back.

However a call like this:

Integer totalSize = (Integer) session.createQuery(countHql)
.setInteger("distance", 45)
.setString("criteria", "%auto%")
.setDouble("lat", lat)
.setDouble("lon", lon)
.uniqueResult();

works just fine in the unit test.

I'm a bit baffled.


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.