-
Notifications
You must be signed in to change notification settings - Fork 3k
Panache Support multiple persistence unit in Hibernate Reactive #50084
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
Conversation
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.
Answered inline
...rc/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java
Outdated
Show resolved
Hide resolved
...me/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java
Outdated
Show resolved
Hide resolved
...te-reactive-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/Panache.java
Outdated
Show resolved
Hide resolved
...e-panache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheEntityBase.java
Outdated
Show resolved
Hide resolved
...nache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java
Outdated
Show resolved
Hide resolved
...nache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java
Outdated
Show resolved
Hide resolved
...-reactive-panache/src/test/java/io/quarkus/it/panache/reactive/PanacheFunctionalityTest.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java
Outdated
Show resolved
Hide resolved
577434e
to
500587e
Compare
I've tackled most of the comments and the current tests are passing I still need to add a few more test for the named persistence unit overload |
🙈 The PR is closed and the preview is expired. |
...rc/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java
Outdated
Show resolved
Hide resolved
...me/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java
Outdated
Show resolved
Hide resolved
...nache/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/PanacheRepositoryBase.java
Outdated
Show resolved
Hide resolved
99cd94a
to
74882ef
Compare
setting "ready for review" as I need CI |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3d9896f
to
f668331
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Tests are passing now! I think it can be reviewed now |
...me/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java
Outdated
Show resolved
Hide resolved
f668331
to
53b91ab
Compare
Well, depends, if on our end we set the value to be a |
AFAIU the things we changed that way are strictly Panache-specific: https://github.com/quarkusio/quarkus/pull/50084/files#diff-22c7ded8d8a11870b590c9c653f8884dffad2727677e07d2c306fb99b48726ebR65-R68 The important one, shared with Hibernate Reactive, didn't change in such a way. But anyway, tests will tell. |
See #50532 |
484a717
to
de52802
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
de52802
to
325830e
Compare
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.
There's one very suspicious test, but if you're sure of what you're doing...
...o/quarkus/hibernate/reactive/panache/test/multiple_pu/MultiplePersistenceUnitConfigTest.java
Show resolved
Hide resolved
...-panache/src/main/java/io/quarkus/it/panache/secondary/SecondaryPersistenceUnitEndpoint.java
Outdated
Show resolved
Hide resolved
So, do we merge this? I can start rebasing Panache 2 on this then. |
325830e
to
95a4f04
Compare
Updated the test and rebased |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
* Integration test for multiple reactive persistence units and Panache Backported from ORM the handling of different persistence units in entity in Panache * `@WithSessionOnDemand` works only with the default persistence unit * withSession overload to take the PU name * Execute update without entity runs on default session * Repository flush() flushes all PUs Refactor * Use ComputingCache instead of a Map<String, LazyValue> * Keep track of onDemand created sessions to close them accordingly * create map of entity => PU in kotlin as well (identical to what happens in Hibernate ORM) * Aligned reactive blocking to orm repositories by using @GenerateBridge to call getSession * getSession shouldn't be static to be substituted by @GenerateBridge * Added Panache.withTransaction overload to select persistence unit * Updated Panache documentation * Support @WithSession("pu-name") and @WithTransaction("pu-name") * Added test to verify the same session is used * Removed dependency from Kotlin panache module to Java, created two new Panache classes inside the Kotlin module and changed the tests accordingly.
95a4f04
to
26e8896
Compare
Status for workflow
|
Status for workflow
|
Yay! 🥳 |
Congrats @lucamolteni :) @gsmet , oddly the bot assigned milestone 3.29.0.CR1 to this PR. I merged it yesterday evening, so I would have expected 3.30.something... ? Did you postpone the release? If so we will need to update the |
Release Notes: Hibernate Reactive Panache Enhancements
Complete support for multiple persistence units in Hibernate Reactive Panache, bringing feature parity with Hibernate ORM
Panache.
New API Methods:
Kotlin Module Independence
The Hibernate Reactive Panache Kotlin module has been changed to depend only on the
hibernate-reactive-panache-common
module, aligning it to the ORM version.Backwards compatibility is maintained through a copy of
Panache
class inside the Kotlin moduleThe copied class will be eventually removed
Fixes this reproducer reported by a user