| It looks like NullLiteralExpression doesn't do any magic and returns plain null:
public String render(RenderingContext renderingContext) {
return "null";
}
It should make cast to appropriate type based on provided javaType. We can manually cast to needed type, but ExpressionImpl provides as function with type check.
@Override
@SuppressWarnings({ "unchecked" })
public <X> Expression<X> as(Class<X> type) {
return type.equals( getJavaType() )
? (Expression<X>) this
: new CastFunction<X, T>( criteriaBuilder(), type, this );
}
So to get proper null literal we should do something like:
b.nullLiteral(Object.class).as(String.class)
For string null. |