Closed Edubits closed 5 years ago
As a workaround I have overriden Provider.HIBERNATE.isAggregation
as follows:
@Override
public boolean isAggregation(Expression<?> expression) {
return (HIBERNATE_BASIC_FUNCTION_EXPRESSION.get().isInstance(expression) && (boolean) invokeMethod(expression, "isAggregation"))
|| (
findClass("org.hibernate.query.criteria.internal.predicate.ComparisonPredicate").get().isInstance(expression) &&
(
isAggregation(invokeMethod(expression, "getLeftHandOperand"))
|| isAggregation(invokeMethod(expression, "getRightHandOperand"))
)
);
}
This adds support for (nested) comparisons where either the left or righthandside of the operation is a aggregation.
Fixed, thanks for workaround hint.
Might only need to check this use case as well for EclipseLink and OpenJPA.
When using a mapping like the following:
it's not detected as an aggregation when adding a filter on the
isFree
field. The filter will be rendered as aWHERE
clause, while it should beHAVING
.