Could not parse expression #1696
-
Hello. I'm using blazebit with postgresql. Now i've started to use postgres arrays with Vlad Mihalcea's ListArrayType. And when i try to query something using where expression like: c.whereExpression(16=ANY(some_array::INT[])) i get and error Could not parse expression '16=ANY(some_array::INT[])', line 1:45 no viable alternative at input '16=ANY(some_array:' |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi. Usually, this is modeled by registering a custom function i.e. public class AnyIntFunction implements JpqlFunction {
@Override
public boolean hasArguments() {
return true;
}
@Override
public boolean hasParenthesesIfNoArguments() {
return true;
}
@Override
public Class<?> getReturnType(Class<?> firstArgumentType) {
return firstArgumentType;
}
@Override
public void render(FunctionRenderContext context) {
context.addChunk("any(");
context.addArgument(0);
context.addChunk("::int[])");
}
} |
Beta Was this translation helpful? Give feedback.
Hi. Usually, this is modeled by registering a custom function i.e.
any_int
and using it in your expressions like16=any_int(someArray)
.You can read more about custom functions and how to register them in the documentation. It will roughly look like this: