-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema validation can fail when ENUM or boolean types are used in entities with MySQL. #25421
Comments
It is surprising to see that it is failing for boolean datatype from
After some investigation it found out that it is liquibase generating datatype as TINYINT which is technically correct for MySQL.
Seems Hibernate schema validation issue. |
For boolean issue, For enum issue, |
For boolean issue, Although we let liquibase decide column datatype, this one needs to be resolved from our side IMO. To be clear, So upgrading the application might break in either case, in theory. |
I think that changing the type in Liquibase is easier than in Hibernate. |
Which is why relying on the |
Following https://hibernate.atlassian.net/browse/HHH-17829?focusedCommentId=115604 for boolean |
Overview of the issue
When Hibernate schema validation is on, the application or tests fail when an enum is used in an entity with MySQL.
Motivation for or Use Case
JHipster generated codes should pass schema validation.
Reproduce the error
src/test/resources/config/application-testdev.yml
to usespring.jpa.hibernate.ddl-auto=validate
andspring.jpa.properties.hibernate.hbm2ddl.auto=validate
. Don't know why two entries for the same thing!./mvnw clean verify
Related issues
Suggest a Fix
Hibernate documentation, 3.11. Enumerated types clearly states that even
@Enumerated(STRING)
is used, it will still map to ENUM column type for MySQL.What I have found is to force the use of the String value, column definition needs to be added.
Then the tests will pass.
JHipster Version(s)
8.1.0
JHipster configuration
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryBrowsers and Operating System
The text was updated successfully, but these errors were encountered: