quarkus: Hibernate ORM SchemaManagementException when running tests
When updating an application from Quarkus 2.1.4 to version 2.4.0, it started to show a schema validation error when starting the application with the command: mvn quarkus:dev.
Failed to start application (with profile dev): org.hibernate.tool.schema.spi.SchemaManagementException: SQL strings added more than once for: '<table_name>'
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.checkExportIdentifier(SchemaCreatorImpl.java:409)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:314)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:167)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:136)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:122)
at org.hibernate.tool.hbm2ddl.SchemaExport.doExecution(SchemaExport.java:314)
at io.quarkus.hibernate.orm.runtime.devconsole.HibernateOrmDevConsoleInfoSupplier.generateDDL(HibernateOrmDevConsoleInfoSupplier.java:77)
at io.quarkus.hibernate.orm.runtime.devconsole.HibernateOrmDevConsoleInfoSupplier.pushPersistenceUnit(HibernateOrmDevConsoleInfoSupplier.java:35)
I noticed that this error also occurs in versions prior to 2.4.0 and that in version 2.4.1 or higher this error was corrected, however, when running the tests, a similar error occurs: mvn test… I have the same error with: mvn clean package…
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.lang.RuntimeException: javax.persistence.PersistenceException: [PersistenceUnit: Pu1] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: Pu1] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: SQL strings added more than once for: <table_name>
I also noticed post-boot validation errors:
(Hibernate post-boot validation thread for App1) Failed to validate Schema: Schema-validation: wrong column type encountered in column...
As it is a legacy system and I cannot change the hibernate mappings or the database, I ended up using the following properties to resolve post-boot errors:
quarkus.hibernate-orm."Pu1".database.generation=none
quarkus.hibernate-orm."Pu1".validate-in-dev-mode=false
quarkus.hibernate-orm."Pu2".database.generation=none
quarkus.hibernate-orm."Pu2".validate-in-dev-mode=false
There are two Persistence Units that use the same mappings! I’m using java 11, Maven 3.8.1, and currently on Quarkus 2.9.0.
@Sanne @yrodiere @gsmet Any ideas to solve the schema validation problem when running the tests? I tried to create a new project and reproduce the problem, but I couldn’t.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (13 by maintainers)
@yrodiere Yes, it works!
Thanks.