Hibernate version:
3.2.x
Mapping documents:
...
<property name="active" not-null="true" />
...
Code between sessionFactory.openSession() and session.close():
criteria.add(Restrictions.eq("active", Boolean.TRUE)).
Name and version of the database you are using:
MySQL 5.x
Hello
I have a class Person with a boolean property active.
This is a primitive boolean and not a Boolean. I prefer boolean because I want it to be either true or false, and not true/false/null.
Is this ok? Or do you suggest using Boolean?
In addition, will the restriction above give me the correct result? Restrictions.eq does not offer a method for binding primitive values.
Also, would Restrictions.eq("active", "1") work? MySQL stores my boolean property as a bit which is stored as 0 or 1.
thanks
|