-
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 post-boot schema-validation fails with Google Spanner after upgrade to Quarkus 2.7.5 #24742
Comments
Does the same happen in Quarkus |
Yes, the problem still is there with version 2.8.0.Final |
@yrodiere does it ring a bell? I remember us having a similar issue but not sure if it was the same? |
@gsmet Not sure it's related, but I'm checking. |
@juan-antonio-alba-db The message mentions a missing table named "RentedCars" (with a trailing "s") while your script creates a table named "RentedCar". So the table "RentedCars" is indeed missing, and if your model maps an entity to that table, then it's completely normal that you're getting that error. Can you check that adding a trailing "s" to "RentedCar" in your SQL script solves the problem? If so, I'll close the ticket. If not, please provide a small reproducer (a small Quarkus application that shows the error upon starting). |
Hi Yoann, The microservice is working ok with version 1.13.6, having a similar application configuration I provided. The issue appears when migrating to the new quarkus version. Let me prepare a full code example to reproduce it |
Hi Luca, this issue was solved in 2.7.2.final version, this is happening in 2.8.0.final. preparing example ... |
Yes, I know. I thought it was the issue the comment I quoted was referring to. |
@yrodiere The readme contains some information worth reading. |
@MrMiyagiSan Thanks a lot! That made the investigation much simpler. The good news is, I reproduced the problem on my machine. The bad news is... It seems to be a spanner-specific problem? I debugged the code, restarting again and again, trying to get to the earliest occurrence of this problem, namely a moment where we're dealing with the I ended up here:
At this point we're trying to generate DDL for the I noticed that, also strangely, the schema management tool involved here is... Spanner's own override of Hibernate ORM's implementation: I had a quick look at the code and, sure enough:
Spanner's schema management tool, which holds state related to the persistence unit it's working on, is shared among all persistence units... In this case this means each persistence unit will inject the service registry into the schema management tool, one after the other, and the last one will win: all persistence units will use the same tool, which happens to use connections to the last persistence unit only. So, yeah. This cannot work. I don't see how it could work in older versions of Quarkus; I suspect the problem was there, but not as visible for you, because you disabled schema management and Quarkus' wasn't forcing validation on startup. IMO Spanner should update their code so that their schema management tool is no longer a singleton; that should solve this problem, at least. I'll edit the ticket description to clarify this is very specific to Spanner. |
We can try reach out to the Google team to improve the integration. But I also happen to think that - when running in Quarkus - Hibernate ORM shouldn't pick up random Essentially, we could fix overriding the upstream issue but only by creating a Spanner extension. Might be worth it for the long term. |
I'm moving from 2.4.1 version to 2.5.0 and this error is also occurring. Is there any way to disable the Hibernate Post Boot validation? |
You can set However, the problem goes beyond validation: anything related to schema initialization through Hibernate ORM with Spanner is likely to produce incorrect results as well. For example, schema management will not work correctly. The Dev UI that displays SQL to create/drop the schema will display incorrect SQL. The button in the Dev UI that recreates the database will not work correctly. Really, the problem is in |
The issue was reported to the As this is not an issue in Quarkus proper, and would affect any framework as soon as you're using If you happen to find this and want to fix the problem, head over to GoogleCloudPlatform/google-cloud-spanner-hibernate#406. |
Describe the bug
When migrating from Quarkus version 1.13.6 to 2.7., I´m facing the following error:
After googling, I saw there was an error with the same error at #23445. But the version I´m trying to use already contains the fix. Then I started to analyse and debug it, and then I´ve found that seems there is another bug.
so let me give you some context information.
Testing it, I´ve seen that adding in the application configuration for the default
The table RentedCars is created in the second database. It explains why the table is not found in default because it checking in the wrong database.
Debugging quarkus code, I´ve found that in SchemaManagementIntegrator.runPostBootValidation(..) when getting the validator for "" the validator.tool.serviceRegistry.configurationsValues contains
hibernate.ejb.persistenceUnitName -> read-database instead of ""
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
configure in application-yml two databases which already define the tables, having database generation to none for both.
database 1
database 2
Automatically the error in shown
I hope this helps to solve the issue.
Thanks in advance
Output of
uname -a
orver
No response
Output of
java -version
openjdk 11.0.9 2020-10-20 LTS
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.7.5-final
Build tool (ie. output of
mvnw --version
orgradlew --version
)apache-maven-3.8.2
Additional information
No response
The text was updated successfully, but these errors were encountered: