| Martin Šimka, your proposed change looks just like what is already done in BasicSimpleCaseTest#testCaseLiteralResult Andrea Boriero, I see that this is caused by wrapping a result with a CAST that was added in HHH-9731, and you plan to remove the CAST with HHH-10085. As mentioned in the description, cast to bit is not suppported for booleans on MySQL or MariaDB. I appears that the cast is not needed when the result is a boolean. I made the following hacky change and the test passes: diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/expression/CaseLiteralExpression.java b/hibernate-ent index d56acff..7a004a2 100644 — a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/expression/CaseLiteralExpression.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/expression/CaseLiteralExpression.java @@ -21,6 +21,9 @@ public class CaseLiteralExpression<T> extends LiteralExpression<T> { @Override public String render(RenderingContext renderingContext) { + 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 return CastFunction.CAST_NAME + '(' + super.render( renderingContext ) + I'm not familiar with the background on HHH-9731 or other recent case-related changes, so I'm not sure of the right way to fix this. Do you? |