-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Describe the bug
See https://quarkusio.zulipchat.com/#narrow/channel/187038-dev/topic/WG.20.2349.20Dev.20Service.20Lifecycle.20chat/near/574964695, @holly-cummins asked for a tracker
While working on #52692 I stumbled upon some peculiar behavior... I end up in a case where Hibernate ORM's "additional configuration provider" gets called, and consequently requests the value of schema-management.strategy being forced to drop-and-create, but... this is only taken into account for the default persistence unit, not for a named one.
This result in Hibernate ORM's schema management not being enabled automatically for named persistence units, which is definitely a bug.
While debugging I noticed the additional config provider (strangely) gets called twice per persistence unit with different parameters, but that doesn't seem to be the root of the problem (see below).
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
- Check out https://github.com/yrodiere/quarkus/tree/hibernate-orm-dev-service-schema-management-drop-and-create-ignored
- Alternatively, check out Remove pointless settings from Hibernate-related integration tests + use dev services in a few more integration tests #52692 and revert the commit with message
Work around https://github.com/quarkusio/quarkus/issues/52699 - Build with
-Dquickly - Run
./mvnw clean verify -Dstart-containers -Dtest-containers -f integration-tests/hibernate-reactive-panache -Dtest=NamedPersistenceUnitsTest - Notice how the schema was not created automatically for persistence unit
secondary - Do not despair
Output of uname -a or ver
No response
Output of java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
To investigate further:
- Put breakpoints:
- Here to see the effective value of
schema-management.strategy: https://github.com/yrodiere/quarkus/blob/02b54c7fdb7b55ad4c2ed178493693088de6afd1/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/FastBootHibernateReactivePersistenceProvider.java#L406 - Here to see the additional configuration provider in action: https://github.com/yrodiere/quarkus/blob/3e0bad96094be2225e3b3696ad0170f25aea368d/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/dev/HibernateOrmDevServicesProcessor.java#L57
- Here to see the effective value of
- Run
./mvnw clean verify -Dstart-containers -Dtest-containers -f integration-tests/hibernate-reactive-panache -Dtest=NamedPersistenceUnitsTest -Dmaven.surefire.debug - Connect your debugger (port 5005)
Strangely:
- The breakpoint gets hit twice for each persistence unit: the first time with username/password config, yielding correct "additional config", and the second time with reactive URL config, yielding incorrect "additional config".
- That in itself doesn't seem to be the problem, because the
<default>persistence unit / datasource seems to behave correctly (schema-management.strategyis set correctly todrop-and-createand acted upon), and only thesecondarypersistence unit / datasource does not (schema-management.strategyis set to its default,none). Also, changing the additional configuration provider, so that it yields correct "additional config" even when provided only with a URL, does NOT work around the problem.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status