Comments (5)
I think that changing the type in Liquibase is easier than in Hibernate.
We must be sure that we don't change the changelog for existing applications otherwise we will create a changelog mismatch error.
Existing database migration if needed should be handled by the user, we cannot do anything about it.
from generator-jhipster.
It is surprising to see that it is failing for boolean datatype from User.java
as well.
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [activated] in table [jhi_user]; found [tinyint (Types#TINYINT)], but expecting [bit (Types#BOOLEAN)]
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateColumnType(AbstractSchemaValidator.java:165)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:152)
at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:46)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:97)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:75)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:295)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:145)
at java.base/java.util.HashMap.forEach(HashMap.java:1429)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:142)
at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37)
at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:315)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:388)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
After some investigation it found out that it is liquibase generating datatype as TINYINT which is technically correct for MySQL.
-- Changeset config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster
CREATE TABLE jhi_user (id BIGINT AUTO_INCREMENT NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60) NULL, first_name VARCHAR(50) NULL, last_name VARCHAR(50) NULL, email VARCHAR(191) NULL, image_url VARCHAR(256) NULL, activated TINYINT NOT NULL, lang_key VARCHAR(10) NULL, activation_key VARCHAR(20) NULL, reset_key VARCHAR(20) NULL, created_by VARCHAR(50) NOT NULL, created_date timestamp NULL, reset_date timestamp NULL, last_modified_by VARCHAR(50) NULL, last_modified_date timestamp NULL, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email)) AUTO_INCREMENT=1050;
Seems Hibernate schema validation issue.
from generator-jhipster.
For boolean issue,
https://hibernate.atlassian.net/browse/HHH-17829
For enum issue,
Will fix using column definition if there is no other solution.
from generator-jhipster.
For boolean issue,
Hibernate team is clearly in favour of using BIT
while starting from Liquibase 4.24.0+ (used in JHipster 8.0.0 and later), it has moved from away from BIT
to TINYINT
as mentioned in Using Liquibase with MySQL - note at the bottom of the page
Although we let liquibase decide column datatype, this one needs to be resolved from our side IMO.
@jhipster/developers Should we keep using BIT
like Hibernate or move to TINYINT
like Liquibase?
To be clear,
- all applications generated before version 8.0.0 are running using BIT
- and from 8.0.0 and later generated are using TINYINT
So upgrading the application might break in either case, in theory.
from generator-jhipster.
Which is why relying on the liquibase-maven-plugin
and the diff
between the referenceUrl
being the annotated entities is useful!
from generator-jhipster.
Related Issues (20)
- Angular: style broken on the threads dump modal
- Use typesafety within the generator HOT 3
- Allow unidirectional one-to-one
- IllegalArgumentException "key cannot be empty or null" on freshly created project. (add steps to the guide or fix the issue) HOT 6
- Oauth2 OIDC - claims - BuiltInUserEntity HOT 6
- side-by-side pattern for vue js
- Can't wrap a component from PrimeReact with ValidatedField.
- Astro for Microfrontend
- Embedded ManyToOne relationships are broken in vue and react frontends.
- Release missing v8 based blueprints. HOT 12
- [React] `serializeError` should not be used by known errors
- Upgrade spring-boot to v3.3.0 HOT 1
- Not generating service files HOT 4
- Upgrade to Angular 18 HOT 2
- Applications should not delete entire User records in tests. HOT 3
- Jhipster Support Sidebar Menu HOT 4
- generatr-blueprint creates *.js files instead of *.mjs HOT 7
- Get "Not Found" error for Entities menu for Micro Frontend entities HOT 3
- Release 8.5.0 with Spring Boot 3.3.0 HOT 18
- Handle generator-jhipster version compatibility using engines. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-jhipster.