aspose file tools*
The moose likes Object Relational Mapping and the fly likes problem in criteria api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "problem in criteria api" Watch "problem in criteria api" New topic
Author

problem in criteria api

Singh Harmeet
Ranch Hand

Joined: Aug 05, 2011
Posts: 115



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?


With Regards :-
Harmeet Singh
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Aug 05, 2011
Posts: 115

sir if you need , i post my all code...
Singh Harmeet
Ranch Hand

Joined: Aug 05, 2011
Posts: 115

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

Joined: Mar 07, 2010
Posts: 1649
    
    7

What Paul asked to see was the Example class


[How To Ask Questions][Read before you PM me]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Aug 05, 2011
Posts: 115

then sir what i do ? i also try to use Example.excludeProperty(String) but this function does not perform any action.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Well, that at least would be a better question if you asked it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in criteria api