I am trying to use hibernate.criterion.Example to find a User model 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!
===User.java===
public class User {
String username ;
Boolean enabled;
public User(String username) {
this.username = username;
}
//get() & set() for username & enabled
//..
}
===UserDao.java===
public List getUsers(User user) {
//using spring's template
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"));
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
hibernate-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel