• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Rajkamal Pillai
Ranch Hand
Posts: 445
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!