You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applying this change to the (MySQL) database changed the column type from binary(32) to blob, and this, in turn, causes the Hibernate schema validation ("hibernate.hbm2ddl.auto"="validate") to fail at runtime:
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [passwordHash] in table [User]; found [blob (Types#LONGVARBINARY)], but expecting [binary(32) (Types#VARBINARY)]
I suspect that the liquibase-hibernate plugin is failing to correctly parse the columnDefinition attribute of the JPA @Column annotation.
For your reference, my baseline changelog generated with liquibase generateChangeLog against the pre-migration database schema (created by Hibernate with "hibernate.hbm2ddl.auto"="create") from the original JPA source code (before I removed the nullable = false constraint) does have the correct column type:
I'm using
liquibase-hibernate5-4.25.1
with ahibernate:ejb3:...
referenceUrl.In my java source code I removed a
nullable = false
attribute from a@Column
annotation on an entity field like this:After making the above modification, I ran
liquibase diff-changelog
and got the following changeset:This is wrong because the actual column type is
binary(32)
, but the generated changeSet usesblob(32)
, which results in the following update SQL:Applying this change to the (MySQL) database changed the column type from
binary(32)
toblob
, and this, in turn, causes the Hibernate schema validation ("hibernate.hbm2ddl.auto"="validate"
) to fail at runtime:I suspect that the liquibase-hibernate plugin is failing to correctly parse the
columnDefinition
attribute of the JPA@Column
annotation.For your reference, my baseline changelog generated with
liquibase generateChangeLog
against the pre-migration database schema (created by Hibernate with"hibernate.hbm2ddl.auto"="create"
) from the original JPA source code (before I removed thenullable = false
constraint) does have the correct column type:The text was updated successfully, but these errors were encountered: