I have a project that I’m converting over to: WF 27/HBM 6.1.5/OJDK17/Jakarta and now H cannot export the schema any more:
Caused by: org.hibernate.MappingException: Error creating SQL create commands for table : pirt.code_address_country
at org.hibernate.tool.schema.internal.StandardTableExporter.getSqlCreateStrings(StandardTableExporter.java:174)
Caused by: org.hibernate.HibernateException: Unable to resolve JDBC type code for column `code_address_country.inactive`
at org.hibernate.mapping.Column.getSqlType(Column.java:289)
at org.hibernate.tool.schema.internal.StandardTableExporter.getSqlCreateStrings(StandardTableExporter.java:99)
... 18 more
Caused by: org.hibernate.MappingException: Could not determine type for column inactive of type org.hibernate.type.internal.CustomMutabilityConvertedBasicTypeImpl: org.hibernate.MappingException
at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:221)
at org.hibernate.mapping.Column.getSqlTypeName(Column.java:261)
at org.hibernate.mapping.Column.getSqlType(Column.java:285)
... 19 more
Caused by: org.hibernate.MappingException: SQLType code's does not match. mapped as 5 but is 16
It worked perfectly before with H 5.x on previous WF versions, even with OJDK 11+/17.
The class hierarchy makes extensive use of mapped super classes and generics; it looks like:
public class CodeAddressCountry extends CodeTableEntity<Integer> implements Serializable {
...
@Audited
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class CodeTableEntity<ID extends Serializable>
extends BaseEntityAuditFields<ID> implements Serializable {
private Boolean inactive;
@Column(name = "inactive", insertable = true, nullable = false, updatable = true)
@Convert(converter = BooleanAsShortConverter.class)
@NotNull(message = "application.anyTable.inactive.required")
public Boolean getInactive() {
return this.inactive;
}
...
@Audited
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class BaseEntityAuditFields<ID extends Serializable> extends BaseEntity<ID> {
...
@Audited
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class BaseEntity<ID extends Serializable> extends Domain<ID> {
...
@Audited
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class Domain<ID extends Serializable> implements Serializable {
private ID id;
Where the converter is:
@Converter
public class BooleanAsShortConverter implements AttributeConverter<Boolean, Short> {
@Override
public Short convertToDatabaseColumn(Boolean attribute) {
Short result = null;
if ( attribute == null ) return result;
if ( attribute ) result = 1;
if ( !attribute ) result = 0;
return result;
}
@Override
public Boolean convertToEntityAttribute(Short dbData) {
Boolean result = null;
if ( dbData == null ) return result;
if ( dbData == 0 ) result = Boolean.FALSE;
if ( dbData == 1 ) result = Boolean.TRUE;
return result;
}
}
I have also tried converters for String/Char (n/y, f/t) and Integer.
Same error only the JDBC type value changes. In this case, from short:
SQLType code’s does not match. mapped as 5 but is 16
to Integer:
SQLType code’s does not match. mapped as 4 but is 16
I use annotations on getters exclusively.