Hi,
After upgrading to Hibernate 6, my application does not start due to a schema validation error.
Schema-validation: wrong column type encountered in column [status]
in table [Usr]; found [int4 (Types#INTEGER)],
but expecting [smallint (Types#TINYINT)]
The User entity has an enum property “status”, and the type of the column “status” in PostgreSQL is an integer.
This code works with Hibernate 5 but does not work with Hibernate 6.
I tried to force the type with a “columnDefinition” like below but that does not work:
@Entity
@Table(name = "Usr")
public class User {
...
@NotNull
@Enumerated(EnumType.ORDINAL)
@Column(columnDefinition = "integer")
private UserStatus status;
...
}
public enum UserStatus {
OK, UNAUTHORIZED
}
Is it a bug?