Hi all,
In Hibernate 6.5.2, I am executing a quite basic HQL query like
var q=createQuery("select z from Entity z where nummer=:nummer and datum=:datum", Entity.class);
q.setReadOnly(true);
q.setParameter("nummer", nummer);
q.setParameter("datum", datum, MyOwnDateJavaType.TYPE);
As you can see, the only special is an own wrapper around DATE type.
When I execute that query, I get an NPE in AbstractSqlAstTranslator line 8251:
SqlTupleContainer.getSqlTuple( comparisonPredicate.getRightHandExpression() ).getExpressions().get( 0 )
because getSqlTuple
returns null. The actual call is SqlParameterInterpretation.getSqlTuple
, which looks for getResolvedExpression
’s type to be SqlTuple
, but it actually is JdbcParameterImpl
.
I got curious because of this left/right hand side thing and just swapped the expression around:
var q=createQuery("select z from Entity z where nummer=:nummer and :datum=datum", Entity.class);
… and it works fine.
Is this a bug, or am I doing something wrong? Isn’t a parameter allowed as right hand side?
Marcus.