I believe you can use the type Boolean in your class instead of
primitive values. This will solve the problem because you can set the
property as null if you don't want to consider it.

Luiz

On 11/30/06, Man-Chi Leung <[EMAIL PROTECTED]> wrote:
hi,

I am trying to use hibernate.criterion.Example to find User by Example

this following code will only get all users which username="myuser" &
enabled="false"
NOT all user regardless enabled = true or false

bcos  when invokes 'new User("myuser")'  ,  user.enabled will be
initialized by constructor as false by default.

any solution ? pls advise!

===UserDao.java===
       public List getUsers(User user) {
               return results = getHibernateTemplate().findByExample(
                                       Example.create(new User("myuser")));
       }


===Another Try  but still failed ===
return results = getHibernateTemplate().findByExample(
       Example.create(new User("myuser")).excludeProperty("enabled"));


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to