From 0c0d4d51612eb4868319a1cd2825867d14059d4d Mon Sep 17 00:00:00 2001 From: Cedomir Igaly Date: Tue, 13 Jun 2023 08:05:36 +0200 Subject: [PATCH] HHH-18117 Proposed solution --- .../org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index 7688634e99..d97aa91b6e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -5470,6 +5470,10 @@ public abstract class BaseSqmToSqlAstConverter extends Base else if ( valueConverter.getRelationalJavaType().isInstance( value ) ) { sqlLiteralValue = value; } + else if ( Character.class.isAssignableFrom( valueConverter.getRelationalJavaType().getJavaTypeClass() ) + && value instanceof CharSequence && ( (CharSequence) value ).length() == 1 ) { + sqlLiteralValue = ( (CharSequence) value ).charAt( 0 ); + } // In HQL, number literals might not match the relational java type exactly, // so we allow coercion between the number types else if ( Number.class.isAssignableFrom( valueConverter.getRelationalJavaType().getJavaTypeClass() )