Given the mapped sleep class:
@Entity
public class MyTestClass {
private Integer aValue;
private Integer bValue;
}
You can do the following using HQL:
Query query
= getCurrentSession().createQuery("select aValue * bValue from MyTestClass");
List<Double> resultList = query.list;
and get the calculated result.
Is it possible to do something similar with the Criteria API? I still haven't found a way to use math operations with the Criteria API. We have aggregate functions like sum, avg, etc., but not basic math operators?
source
share