Active Record calculator

Calculator

You can use ActiveRecord home instance for some simple calculation of records. You can do count(), sum(), avg(), max(), and min().

    Calculator cal = Calculator.getCalculator(Employee.class);

    //SQL: select min(age) from employees;
    int youngestAge = Util.getSafeIntValue(cal.minium("age"));

    //SQL: select avg(salary) from employees;
    double avgSalary = Util.getSafeDoubleValue(cal.average("salary"));