HHH-18564 Handle attribute converters for query literals

Allow both domain and relational forms when an attribute converter is present
This commit is contained in:
Marco Belladelli 2024-09-09 11:01:14 +02:00
parent d1980cba14
commit 9886b7acf9
1 changed files with 5 additions and 4 deletions

View File

@ -7425,12 +7425,13 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
); );
} }
@SuppressWarnings({"unchecked", "rawtypes"})
@Override @Override
public Object visitFieldLiteral(SqmFieldLiteral<?> sqmFieldLiteral) { public Object visitFieldLiteral(SqmFieldLiteral<?> sqmFieldLiteral) {
return new QueryLiteral<>( final BasicValuedMapping valueMapping = (BasicValuedMapping) determineValueMapping( sqmFieldLiteral );
sqmFieldLiteral.getValue(), final Object value = sqmFieldLiteral.getValue();
(BasicValuedMapping) determineValueMapping( sqmFieldLiteral ) final BasicValueConverter converter = valueMapping.getJdbcMapping().getValueConverter();
); return new QueryLiteral<>( converter != null ? sqlLiteralValue( converter, value ) : value, valueMapping );
} }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~