Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic