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.
|