*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help framing Hibernate Criteria based on SQL statement with mutiple clauses.
 
Similar Threads
Hibernate Criteria Query not working properly
SQL-Query not returning specified Object
Hibernate with native SQL issue
Hibernate - Conditions are not applied in Inner Criteria Query
listing hibernate named queries from java