diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java index 00743146139d..139b5eed73ca 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java @@ -40,6 +40,8 @@ import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.spi.SQLExceptionConversionDelegate; import org.hibernate.mapping.CheckConstraint; +import org.hibernate.metamodel.mapping.SqlExpressible; +import org.hibernate.metamodel.mapping.SqlTypedMapping; import org.hibernate.query.sqm.CastType; import org.hibernate.query.sqm.IntervalType; import org.hibernate.query.sqm.function.SqmFunctionRegistry; @@ -1097,6 +1099,17 @@ public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfi return "cast(null as " + castType + ")"; } + // Add override for the newer signature to access columnDefinition + @Override + public String getSelectClauseNullString(SqlTypedMapping sqlType, TypeConfiguration typeConfiguration) { + final DdlTypeRegistry ddlTypeRegistry = typeConfiguration.getDdlTypeRegistry(); + final String castTypeName = ddlTypeRegistry + .getDescriptor( sqlType.getJdbcMapping().getJdbcType().getDdlTypeCode() ) + .getCastTypeName( sqlType.toSize(), (SqlExpressible) sqlType.getJdbcMapping(), ddlTypeRegistry ); + return "cast(null as " + castTypeName + ")"; + } + + private static String castType(DdlType descriptor) { final String typeName = descriptor.getTypeName( Size.length( Size.DEFAULT_LENGTH ) ); //trim off the length/precision/scale