Thursday, 17 July 2014

Hibernate Criteria retrieve records when two fields are equal

Here is the code snippet from my project to retrieve the records when two field value in the  table has the same value.

if (laborderConditions.getBalanceStatus() != null) {
if (laborderConditions.getBalanceStatus().equalsIgnoreCase("Open")) {
criteria.add(Restrictions
.sqlRestriction("IFNULL(amount,0)=IFNULL(balance,0)"));
}

}

4 comments:

  1. is that condition inside .sqlRestriction(" ") is assigning value or comparing value ?

    ReplyDelete
  2. Interesting and important information. It is really beneficial for us. Thanks
    Herbal Incense

    ReplyDelete
  3. Do you have any more related blogs or ideas related to like your this blog, it will help me in my further research work…Will keep following your blogs

    incense online

    ReplyDelete