wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Help framing Hibernate Criteria based on SQL statement with mutiple clauses. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Help framing Hibernate Criteria based on SQL statement with mutiple clauses." Watch "Help framing Hibernate Criteria based on SQL statement with mutiple clauses." New topic
Author

Help framing Hibernate Criteria based on SQL statement with mutiple clauses.

Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi,

I am trying to frame a Hibernate Criteria nased query for a SQL I am using in an application. The requirement is to find the name of all members who are not married or married with at least 2 children between the ages of {MIN_AGE} and {MAX_AGE}. The table structure and the SQL I use is below.





I tried creating a Criteria object on the POJO and adding Restrictions. Using Criteria/Restrictions objects I get a single query with the clauses minus the brackets? The results vary as the brackets and hence the hierarchy of the query evaluation is altered. Is there any way I get the desired query translated to Hibernate Criteria/Restrictions?

Raj.
 
Don't get me started about those stupid light bulbs.
 
subject: Help framing Hibernate Criteria based on SQL statement with mutiple clauses.