-
Couldn't load subscription status.
- Fork 8
Building an arithmetic value expression
gert-wijns edited this page Sep 13, 2014
·
2 revisions
Arithmetic value expressions can be built using the builder available on the query.
ArithmeticTypeSafeValueFactory ab = query.getArithmeticsBuilder();
Person person = query.from(Person.class);
query.select(
ab.add(
ab.value(person.getId()),
ab.divide(
ab.value(1D),
ab.subtract(
ab.value(10d),
ab.value(person.getAge()))),
ab.value(person.getId())
));
=> "select (hobj1.id + (1.0 / (10.0 - hobj1.age)) + hobj1.id)
from Person hobj1"