After migrating from hiberante 5.1.2 to hibernate 6.2.6 as i understand it, i must used CompositeUserType (instead of userType) to map 2 columns to one object. It’s all working great BUT if this object contains generic fields then i get NPE:
Caused by: java.lang.NullPointerException: Cannot invoke "[I.clone()" because "original.originalPropertyOrder" is null
at org.hibernate.mapping.Component.<init>(Component.java:121) ~[hibernate-core-6.2.6.Final.jar:6.2.6.Final]
at org.hibernate.mapping.Component.copy(Component.java:137) ~[hibernate-core-6.2.6.Final.jar:6.2.6.Final]
at org.hibernate.boot.model.internal.ClassPropertyHolder.handleGenericComponentProperty(ClassPropertyHolder.java:246) ~[hibernate-core-6.2.6.Final.jar:6.2.6.Final]
at org.hibernate.boot.model.internal.ClassPropertyHolder.addPropertyToPersistentClass(ClassPropertyHolder.java:264) ~[hibernate-core-6.2.6.Final.jar:6.2.6.Final]
at org.hibernate.boot.model.internal.ClassPropertyHolder.addProperty(ClassPropertyHolder.java:217) ~[hibernate-core-6.2.6.Final.jar:6.2.6.Final]
Sample code:
Entity:
@CompositeType(value = FooUserType.class)
@AttributeOverrides({
@AttributeOverride(name = "type", column = @Column(name = "column1", updatable = false)),
@AttributeOverride(name = "json", column = @Column(name = "column2", updatable = false, columnDefinition = "clob"))
})
protected Foo foo;
FooUserType:
public class FooUserType implements CompositeUserType<Foo> {
}
Foo:
public class Foo<T extends Enum<T>> implements AnotherInterface<T> {
private final T type;
private String revision;