You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an entity that uses the JPQLPredicateGenerator annotation for one of its fields. I'm trying to create a FilterExpression check and I was wondering if there's a way to use the same logic for the expression check. Right now I can get the query to run but the where clause is not the desired clause so we get no results. Basically I need the custom expression that is used in JPQLPredicateGenerator.
public class Foo {
private String name;
private Set<String> stuff;
@JPQLFilterFragment(operator = Operator.IN_INSENSITIVE, generator = StringListInFilter.class)
public Set<String> getStuff(){ return stuff; }
}
public class StringListInFilter implements JPQLPredicateGenerator {
public String generate(FilterPredicate filterPredicate, Function<Path, String> aliasGenerator) {
// Does some database specific casting
}
}
public class FooFilter extends FilterExpressionCheck<Foo> {
public FilterExpression getFilterExpression(Type<?> type, RequestScope requestScope) {
Set<String> desiredStuff = getDesired();
InfixInsensitivePredicate stuffCondition =
new InfixInsensitivePredicate(
new Path.PathElement(
Foo.class, String.class, "stuff"), desiredStuff));
// Doesn't use JPQL logic so isn't the desired where clause
return stuffCondition;
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an entity that uses the JPQLPredicateGenerator annotation for one of its fields. I'm trying to create a FilterExpression check and I was wondering if there's a way to use the same logic for the expression check. Right now I can get the query to run but the where clause is not the desired clause so we get no results. Basically I need the custom expression that is used in JPQLPredicateGenerator.
Beta Was this translation helpful? Give feedback.
All reactions