• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in criteria api

 
Singh Harmeet
Ranch Hand
Posts: 115
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


in this code i am trying to use criteria api to retrive the data from database and my citeria is :-



but the query generated by this code is


in my criteria i am try to use only login name but verfied is automatially include why?
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any code there which says to use, or not to use, any of the fields of the User class in the generated query. So therefore I don't find it surprising that all of the fields are used.

But perhaps that code is hidden somewhere in that Example class, which I don't see?

At any rate here's a link to a relevant (I hope) tutorial: Chapter 15. Criteria Queries.
 
Singh Harmeet
Ranch Hand
Posts: 115
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir if you need , i post my all code...
 
Singh Harmeet
Ranch Hand
Posts: 115
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir in my user class the verfied property is boolean . this is my user class structure


i think this problem is from default value of user classs? and if i create the criteria according to User id field , the query generate by hibernate not include id field in where clause .
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Paul asked to see was the Example class
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or any code at all which put any restrictions on the Criteria object. I don't see any, and what you post suggests that there aren't any. In other words, that's completely not surprising. And I'm not sure why you think the fact that an attribute is a boolean attribute should make a difference.
 
Singh Harmeet
Ranch Hand
Posts: 115
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then sir what i do ? i also try to use Example.excludeProperty(String) but this function does not perform any action.
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that at least would be a better question if you asked it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic