-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix #13425 Hibernate ORM and Hibernate Reactive cannot be used in the same application #44473
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! Your pull request does not follow our editorial rules. Could you have a look?
This message is automatically generated by a bot. |
Thanks! I'll have a closer look tomorrow, but a few early comments:
Can this be more "hidden"? E.g. move the annotation to a clearly internal package, or even just don't make it a bean for Hibernate Reactive. The reason I'm asking is that users really shouldn't be using the
A few things:
|
I agree with your point, I'll work on it and see if I can hide it somehow. But yes it's just a matter of CDI injection (answering also 1 below)
I don't see how this should prevent the multiple units to be implemented, it's something that has to be done from scratch anyway
I saw that as well, but I also saw the original persistence unit default string hardcoded and that was a problem, so I thought that keeping it separated would be better. |
Impressive. I've no idea how to support this in Panache, though 😱 |
This comment has been minimized.
This comment has been minimized.
e670280
to
db5dbb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I must say I didn't expect this to be doable with so few changes... impressive indeed. Though I guess we need to see where test failures are coming from :)
I also added a few comments below.
} else if (capabilities.isPresent(Capability.HIBERNATE_REACTIVE)) { | ||
// We have reactive, but we have also defined a blocking datasource | ||
return ImpliedBlockingPersistenceUnitTypeBuildItem.generateImpliedPersistenceUnit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly the same code as the else
block... probably not useful?
Regardless, I'm wondering if this whole code is still useful. During earlier discussions, the idea was that a given persistence unit would have a blocking variant if the associated datasource has its JDBC variant enabled, and a non-blocking variant if the associated datasource has its reactive variant enabled.
Applying this logic to the default persistence unit probably gives us the same behavior as this code... or an even more correct one, as it wouldn't depend on unrelated datasources?
...ns/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/ReactivePersistenceUnit.java
Outdated
Show resolved
Hide resolved
...nt/src/main/java/io/quarkus/hibernate/orm/deployment/PersistenceUnitDescriptorBuildItem.java
Outdated
Show resolved
Hide resolved
...yment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java
Show resolved
Hide resolved
...yment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java
Outdated
Show resolved
Hide resolved
...src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java
Outdated
Show resolved
Hide resolved
...gration-tests/hibernate-reactive-orm-compatibility/src/main/resources/application.properties
Outdated
Show resolved
Hide resolved
...gration-tests/hibernate-reactive-orm-compatibility/src/main/resources/application.properties
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
c4440ce
to
eeba221
Compare
🎊 PR Preview 4c8e860 has been successfully built and deployed to https://quarkus-pr-main-44473-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
...ons/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/NoJtaTest.java
Outdated
Show resolved
Hide resolved
...st/java/io/quarkus/hibernate/reactive/sql_load_script/FileNotFoundSqlLoadScriptTestCase.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
eeba221
to
fc74c77
Compare
@yrodiere I removed the annotation, I had to ignore a |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup; I think removing ReactiveSessionFactoryProducer
definitely is a good move.
I see this is still WIP (failing tests?) though, so I'll let you work now :]
...bernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ClassNamesTest.java
Outdated
Show resolved
Hide resolved
...nt/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveCdiProcessor.java
Show resolved
Hide resolved
|
||
for (PersistenceUnitDescriptorBuildItem persistenceUnitDescriptor : persistenceUnitDescriptors) { | ||
String persistenceUnitName = persistenceUnitDescriptor.getPersistenceUnitName(); | ||
String persistenceUnitConfigName = persistenceUnitDescriptor.getConfigurationName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your changes, the concept of "configuration name" might not be relevant at all anymore... If so we'll need to remember to clean this up and remove getConfigurationName()
and related code from the codebase.
fc74c77
to
664c890
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
664c890
to
2831b76
Compare
This comment has been minimized.
This comment has been minimized.
…ave a JDBC data source we don't generate the blocking pU
…ionFactory bean in the extension itself
…ngPersistenceUnitType in HibernateReactiveCdiProcessor
…active PU as well" This reverts commit 9109611.
* Added reactive configuration key to DataSourceBuildTimeConfig (not sure if it's a good idea) * Removed quarkus-jdbc-h2-deployment as the reactive tests are based on postgres * Postgres quarkus-jdbc-postgresql-deployment which triggers agroal is included with forcedDependencies to not include in every reactive test * Tests are included for default data source / PU, named Datasource and named PU
…ata source supports reactive to avoid failing while using reactive and blocking together
Fix ConfigActiveFalseAndEntityTest.mutinySessionFactory
a311205
to
c466e14
Compare
Fixes #13425
I've added a test to verify the compatibility of both the extensions together.
This is not a big refactor as both extensions are still coupled together, but this lets users use both implementation in their Quarkus application.
The idea is to have a MultiplePersistenceProviderResolver https://github.com/quarkusio/quarkus/compare/main...lucamolteni:13425-ter?expand=1#diff-c1c6c402fc142de3b1c4d726cb080f2b856cf560b693a1686f52ad3a35a972f0R10
And filter the correct one at runtime
https://github.com/quarkusio/quarkus/compare/main...lucamolteni:13425-ter?expand=1#diff-db8c5c1b299098a43c5d8e4b3f3267e4bb72c6e7841536d9bbb487dcff8c54ffR88
There's also a new ReactivePersistenceUnit annotation https://github.com/quarkusio/quarkus/compare/main...lucamolteni:13425-ter?expand=1#diff-8c10ee8583155144d5c9f796e33b785471701a346c768b2f707fe3a036f0590dR24 in order to disambiguate the correct bean to be injected.
I've also changed the default name for the reactive persistence unit as there are effectively two together and they can't share the same name.
Connection strings are in two different fields so they don't collide
https://github.com/quarkusio/quarkus/compare/main...lucamolteni:13425-ter?expand=1#diff-6dd4fdea2c39574c084d9b03d106b6dd15b4877db728858cebf88641216bcd72R13
Feedbacks are welcome