Skip to content

Commit cff5d89

Browse files
committed
HHH-19974 Refactor InformixDialect to override the new getSelectClauseNullString signature.
Instead of relying on columnDefinition logic, this change utilizes the DdlTypeRegistry to dynamically determine the correct cast type name, ensuring better compatibility and correctness for null handling in select clauses on Informix. Signed-off-by: namucy <wkdcjfdud13@gmail.com>
1 parent 82d913d commit cff5d89

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import org.hibernate.exception.LockAcquisitionException;
4141
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
4242
import org.hibernate.mapping.CheckConstraint;
43+
import org.hibernate.metamodel.mapping.SqlExpressible;
44+
import org.hibernate.metamodel.mapping.SqlTypedMapping;
4345
import org.hibernate.query.sqm.CastType;
4446
import org.hibernate.query.sqm.IntervalType;
4547
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
@@ -1097,6 +1099,17 @@ public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfi
10971099
return "cast(null as " + castType + ")";
10981100
}
10991101

1102+
// Add override for the newer signature to access columnDefinition
1103+
@Override
1104+
public String getSelectClauseNullString(SqlTypedMapping sqlType, TypeConfiguration typeConfiguration) {
1105+
final DdlTypeRegistry ddlTypeRegistry = typeConfiguration.getDdlTypeRegistry();
1106+
final String castTypeName = ddlTypeRegistry
1107+
.getDescriptor( sqlType.getJdbcMapping().getJdbcType().getDdlTypeCode() )
1108+
.getCastTypeName( sqlType.toSize(), (SqlExpressible) sqlType.getJdbcMapping(), ddlTypeRegistry );
1109+
return "cast(null as " + castTypeName + ")";
1110+
}
1111+
1112+
11001113
private static String castType(DdlType descriptor) {
11011114
final String typeName = descriptor.getTypeName( Size.length( Size.DEFAULT_LENGTH ) );
11021115
//trim off the length/precision/scale

0 commit comments

Comments
 (0)