Search code examples
javaspringhibernatecriteriahibernate-criteria

How to get a greater than record in Hibernate - Criteria Queries?


Amount value is type of Big Decimal and logic should be _customerPayeeTransaction.getAmount() > 10 000.00

How to change following Criteria to match with above logic?

Criterion amount = Restrictions.gt("cpt.amount", _customerPayeeTransaction.getAmount());

Please Help me.


Solution

  • If u want to add filter amount lower than 10 000 : 
    
    Criterion amount = Restrictions.lt("cpt.amount", new BigDecimal("10000.00"));