In this example:
abs(train.specs.maxLoad) > 0
It's impossible to translate this example to JPA Criteria API considering the function has to define its type:
<T> Expression<T> function(String name, Class<T> type,
Expression<?>... args);
I think the solution would be to add type to FunctionExpression.