HHH-10412 : case/when in criteria always casts resulting object which fails on mysql with boolean
This commit is contained in:
parent
c783aab919
commit
b1fef6c70b
|
@ -21,6 +21,13 @@ public class CaseLiteralExpression<T> extends LiteralExpression<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
|
// There's no need to cast a boolean value and it actually breaks on
|
||||||
|
// MySQL and MariaDB because they don't support casting to bit.
|
||||||
|
// Skip the cast for a boolean literal.
|
||||||
|
if ( getJavaType() == Boolean.class && Boolean.class.isInstance( getLiteral() ) ) {
|
||||||
|
return super.render( renderingContext );
|
||||||
|
}
|
||||||
|
|
||||||
// wrapping the result in a cast to determine the node type during the antlr hql parsing phase
|
// wrapping the result in a cast to determine the node type during the antlr hql parsing phase
|
||||||
return CastFunction.CAST_NAME + '(' +
|
return CastFunction.CAST_NAME + '(' +
|
||||||
super.render( renderingContext ) +
|
super.render( renderingContext ) +
|
||||||
|
|
Loading…
Reference in New Issue