-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Hibernate ORM SchemaManagementException when running tests #25607
Comments
I think I just found the solution. The error presented in the log didn't help me much. I think it would be nice to evaluate to see if there is any improvement in the Hibernate ORM extension or another point to make the reason clearer. |
i'm also facing this issue after upgrading an existing app ( SQL Server ) from Quarkus 1.9.2.Final to 2.9.1.Final ( Flyway extension is being used as well ) |
Sorry, but I'm not sure I understand what the problem is here... From what I've read:
Can you show me a full configuration that you expect to work, the full command line that you're using to build/start/test the application, and the full stack trace that you're getting (please don't remove any line starting with |
Note that even if you can't provide a full reproducer, the information above might be enough to at least understand what the problem is :) |
Hi @yrodiere I solved the problem by adding the "quarkus.datasource" property. The main fact is that until version 2.1.4 the tests worked even without the "quarkus.datasource" property (there was only this property with %dev profile) and the stack trace is not showing the real reason, making it difficult to find or understand what is going on. My application.properties without %prod properties, without the fix and without sensitive data:
Command: Test execution error:
Error stack trace:
|
Thanks for the precisions. A few more questions:
Which one exactly?
Unfortunately, that stack trace is not complete... Any chance you can look into the test report (
This error most likely happens because two entities are bound to the same table, for some reason. I really wonder how configuring the datasource could solve that problem... |
quarkus.datasource."DB1".jdbc.url
The stack trace is the same. I took a look at the .xml file on surefire-reports and found this:
If there was an authentication error the application would not even run. And the login data are correct...
I agree with you. This looks weird but... |
I just updated the quarkus version to 2.9.2 and the Java version to 17 and I also changed the name of the PUs (I noticed that one of them had the same name of the database schema and so I decided to change it to test). Now when I run the tests I don't have the error 'SQL strings added more than once for: <schema_name>.<table_name>' anymore. Now when I run the tests without 'quarkus.datasource."DB1".jdbc.url' (only with %dev.quarkus.datasource."DB1".jdbc.url) I get this:
The application still runs without error with the command 'quarkus:dev' When I add the %test.quarkus.datasource."DB1".jdbc.url everything is ok. Now It is clear that after version 2.1.4 it is mandatory to specify this property, but the error presented made it difficult to understand/discover. |
@yrodiere I believe that now you can identify the origin of the weird message and fix it, if necessary. Thanks! |
The JDBC URL is mandatory if you want to use your own database. In dev mode and tests, the lack of JDBC URL should not cause any problem, as Quarkus will launch a container automatically if there's no JDBC URL.
This is... very, very strange. I definitely don't know how in the world this could lead to a problem, as the PU name and schema name are handled by very different parts of the codebase. Maybe that was just a coincidence, and you changed something else in the config? You really meant "PU name and schema name"? Not "PU name and datasource name"? I'm asking because I noticed a strange behavior when the PU name and datasource name are different: #26507
I'm sorry but no, I can't... And, believe me, I tried. In this discussion, I'm counting three different error messages, multiple versions of Quarkus, and multiple sets of configuration properties, only one of which is complete and explicit. I just can't put that together and build a reproducer: all I could get is the behavior I would expect (either it works, or I get a different error than you, and one that is expected considering the configuration). If you want me to fix something, please provide a simple reproducer. If you want, you can start from my attempt:
There's a script in that directory to launch postgres and initialize the databases: |
I did some more tests to help you.
Yes it was just a coincidence. When I changed de PU name I also changed DS name. Hope this helps! Thanks for your attention. |
Hey @leonardowestphal , can you confirm that fixing #26507 fixed all the problems you mentioned in this thread? The fix is included in Quarkus 2.11.1. |
I got no answer, so I'll assume this was fixed; please reopen this ticket and/or ping me if it wasn't. |
@yrodiere Thanks. |
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.
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...
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:
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.
The text was updated successfully, but these errors were encountered: