-
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
Hibernate Reactive with Panache: support stateless sessions #46091
Comments
/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive), @loicmathieu (panache) |
Also, related, I need to ask @DavideD for a shared session interface for protected abstract <T> Uni<T> find(SessionType session, Class<T> entityClass, Object id);
protected abstract <T> Uni<T> find(SessionType session, Class<T> entityClass, Object id, LockMode lockMode);
protected abstract <R> Mutiny.SelectionQuery<R> createSelectionQuery(SessionType session, String var1, Class<R> var2);
protected abstract <R> Mutiny.SelectionQuery<R> createNamedQuery(SessionType session, String var1, Class<R> var2);
protected abstract <R> Mutiny.Query<R> createNamedQuery(SessionType session, String var1);
protected abstract Mutiny.MutationQuery createMutationQuery(SessionType session, String var1); I will open an issue in HR for that. |
Yes, please. |
Laziness is where it's at. Something to note though, if you use both |
That makes a lot of sense. I guess we could do the same then.
Ah yes, I did wonder about that. This makes perfect sense to me, and aligns with what we can achieve in HR/Panache. So, good. |
👍
Uh, there was a mistake there: I think the sessions have their own connection, but possibly use the same transaction -- which will fail if XA is disabled, but will work if XA is enabled. |
Ah, and I thought we did not support XA in Quarkus? |
Not in Hibernate Reactive (AFAIK), but very much in Agroal / Hibernate ORM: https://quarkus.io/guides/datasource#datasource-multiple-single-transaction |
Damnit. |
@FroMage, I went ahead and created the issue for the shared contract: hibernate/hibernate-reactive#2104 |
@FroMage Or have something like |
Description
As part of the work for #36168 I need to add support for stateless sessions in Hibernate Reactive with Panache.
Adding support in
SessionOperations
is easy enough, I can just duplicate most methods.Figuring out what to do with
@WithTransaction
@WithSession
and@WithLazySession
is not entirely clear to me.The problem is that in HR, transactions are tied to sessions, and so in order to obtain one TX we need to open a session, so pick a type.
Since it appears I can do in plain ORM:
I would like to be able to achieve the same with HR/Panache:
But ATM,
@WithTransaction
will open only a managed session.I suppose it could open both sessions, but then we'd have two transactions, so that's not ideal.
Or we make a separate
@WithStatelessTransaction
but that's annoying.We can definitely make
@WithSession
and@WithStatelessSession
for explicit sessions.I suppose we could make
@WithLazySession
open up laziness for both managed and stateless sessions at the same time.I do wonder how ORM deals with these questions, I need to check.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: