Hi
I met a problem when I use the class org.hibernate .Criteria
my code were as follow:
//
User user=new User("good");
Example example=Example.create(user)
.excludeZeroes()
.excludeProperty("password") .ignoreCase() .enableLike();
List result=session.createCriteria(User.class)
.add(example).list();
//
the problem is when i use the primary key as a filter ,it will get all the rows in the database out,if I use other column else,it will work all right.
my question is can't we use primary key?
when i use primary key ,the sql Hibernate created is as follow:
select this_.username as username0_, this_.password as password1_0_, this_.email as email1_0_, this_.ranking as ranking1_0_, this_.created as created1_0_, this_.street as street1_0_, this_.zipcode as zipcode1_0_, this_.city as city1_0_, this_.firstname as firstname1_0_, this_.lastname as lastname1_0_ from user this_ where (1=1)
why the where condition is always true?
|