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
SELECT FROM MyClass WHERE :myObj.someField.contains(this.field)
and then try to compile it, we get a message like
org.datanucleus.store.rdbms.sql.expression.IllegalExpressionOperationException: Cannot perform operation ".contains" on org.datanucleus.store.rdbms.sql.expression.NullLiteral@2ea41516
at org.datanucleus.store.rdbms.sql.expression.SQLExpression.invoke(SQLExpression.java:601)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processInvokeExpression(QueryToSQLMapper.java:3585)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compilePrimaryExpression(AbstractExpressionEvaluator.java:213)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileUnaryExpression(AbstractExpressionEvaluator.java:182)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileAdditiveMultiplicativeExpression(AbstractExpressionEvaluator.java:161)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileRelationalExpression(AbstractExpressionEvaluator.java:136)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileOrAndExpression(AbstractExpressionEvaluator.java:78)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.evaluate(AbstractExpressionEvaluator.java:46)
at org.datanucleus.query.expression.Expression.evaluate(Expression.java:338)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compileFilter(QueryToSQLMapper.java:495)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compile(QueryToSQLMapper.java:416)
at org.datanucleus.store.rdbms.query.JDOQLQuery.compileQueryFull(JDOQLQuery.java:918)
at org.datanucleus.store.rdbms.query.JDOQLQuery.compileInternal(JDOQLQuery.java:344)
at org.datanucleus.store.query.Query.compile(Query.java:1669)
This is because the parameter doesn't have a value at the point of compilation, hence you have the equivalent of an NPE but in a query. Need a better way of handling this
The text was updated successfully, but these errors were encountered:
andyjefferson
changed the title
Handle compilation of ":param.collField.contains()" for (implicit) named parameters
JDOQL : Support compilation of ":param.collField.contains()" for (implicit) named parameters
Sep 15, 2017
If we want to do something like
SELECT FROM MyClass WHERE :myObj.someField.contains(this.field)
and then try to compile it, we get a message like
org.datanucleus.store.rdbms.sql.expression.IllegalExpressionOperationException: Cannot perform operation ".contains" on org.datanucleus.store.rdbms.sql.expression.NullLiteral@2ea41516
at org.datanucleus.store.rdbms.sql.expression.SQLExpression.invoke(SQLExpression.java:601)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.processInvokeExpression(QueryToSQLMapper.java:3585)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compilePrimaryExpression(AbstractExpressionEvaluator.java:213)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileUnaryExpression(AbstractExpressionEvaluator.java:182)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileAdditiveMultiplicativeExpression(AbstractExpressionEvaluator.java:161)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileRelationalExpression(AbstractExpressionEvaluator.java:136)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.compileOrAndExpression(AbstractExpressionEvaluator.java:78)
at org.datanucleus.query.evaluator.AbstractExpressionEvaluator.evaluate(AbstractExpressionEvaluator.java:46)
at org.datanucleus.query.expression.Expression.evaluate(Expression.java:338)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compileFilter(QueryToSQLMapper.java:495)
at org.datanucleus.store.rdbms.query.QueryToSQLMapper.compile(QueryToSQLMapper.java:416)
at org.datanucleus.store.rdbms.query.JDOQLQuery.compileQueryFull(JDOQLQuery.java:918)
at org.datanucleus.store.rdbms.query.JDOQLQuery.compileInternal(JDOQLQuery.java:344)
at org.datanucleus.store.query.Query.compile(Query.java:1669)
This is because the parameter doesn't have a value at the point of compilation, hence you have the equivalent of an NPE but in a query. Need a better way of handling this
The text was updated successfully, but these errors were encountered: