HHH-10412 : case/when in criteria always casts resulting object which fails on mysql with boolean
(cherry picked from commit b1fef6c70b
)
This commit is contained in:
parent
44e4608fd5
commit
b540ad43ee
|
@ -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