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)"));
}

}

No comments:

Post a Comment