H. Lo (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZWY3OWRjOGQ3...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16498?atlOrigin=eyJpIjoiZWY3OW...
) HHH-16498 (
https://hibernate.atlassian.net/browse/HHH-16498?atlOrigin=eyJpIjoiZWY3OW...
) Hibernate DDL validation fails on enum database column type (
https://hibernate.atlassian.net/browse/HHH-16498?atlOrigin=eyJpIjoiZWY3OW...
)
Issue Type: Bug Affects Versions: 6.2.1 Assignee: Unassigned Components: hibernate-core
Created: 21/Apr/2023 01:56 AM Priority: Minor Reporter: H. Lo (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Few days ago I switched my Java Spring Boot project from Hibernate ORM 6.1.7 to Hibernate
ORM 6.2.1.
The underlying database is MySQL 8 which supports enum data type.
In one of my entities I have `enum` which is annotated by @Enumerated(EnumType.STRING) and
so far it was working as expected - varchar table column was created by Hibernate few
years ago.
spring.jpa.hibernate.ddl-auto = validate
After switching to Hibernate ORM 6.2.1 this table column was converted to MySQL’s enum
data type.
When I try to start my app with spring.jpa.hibernate.ddl-auto set to validate - an
exception is thrown:
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException:
Schema-validation: wrong column type encountered in column [sign_position]
in table [custom_currency];
found [enum (Types#CHAR)], but expecting [varchar(255) (Types#VARCHAR)]
If I change ddl-auto setting to update or none , the table column of enum type stays as it
is and application can boot up.
Steps are:
* spring.jpa.hibernate.ddl-auto = update
* run the app
* database is updated
* stop the app
* spring.jpa.hibernate.ddl-auto = validate
* run the app
* exception is thrown
Hibernate Discourse post:
https://discourse.hibernate.org/t/hibernate-validate-fails-on-enum/7535
(
https://hibernate.atlassian.net/browse/HHH-16498#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16498#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100223- sha1:bddbaa2 )