| Hi Gail Badner, i think the cats is necessary just with string parameters, because of in
org.hibernate.jpa.criteria.expression.LiteralExpression
class, the method
public String render(RenderingContext renderingContext) {
if ( ValueHandlerFactory.isNumeric( literal ) ) {
return ValueHandlerFactory.determineAppropriateHandler( (Class) literal.getClass() ).render( literal );
}
else if ( ValueHandlerFactory.isBoolean( literal ) ) {
return ValueHandlerFactory.determineAppropriateHandler( (Class) literal.getClass() ).render( literal );
}
final String parameterName = renderingContext.registerLiteralParameterBinding( getLiteral(), getJavaType() );
return ':' + parameterName;
}
substitutes the parameterName with the literal value when the type is Numeric or is a Boolean so no cast is needed in such cases But the
org.hibernate.jpa.criteria.expression.LiteralExpression#render(RenderingContext renderingContext)
introduces causes the issue https://hibernate.atlassian.net/browse/HHH-9576 so probably at the moment your solution is fine. |