Replies: 6 comments 12 replies
-
/cc @DavideD, @FroMage, @Sanne, @gavinking, @loicmathieu |
Beta Was this translation helpful? Give feedback.
-
Maybe I'm wrong on this but I don't think it's an issue to reuse the same session if the transaction is marked for rollback and there are no errors (@gavinking ?) I think the problem is that
Another issue comes when using I think it would also be helpful to add some methods to Panache to explicitly discard the current session and create a new one. Something like |
Beta Was this translation helpful? Give feedback.
-
Ok, let me rephrase the question: wouldn't it be convenient/more safe to discard the session if the upstream Uni fires a failure? (Uni returned by The current behavior is not very intuitive and may lead to errors that are hard to identify.
A similar convenient method would be helpful but still a user needs to know that it exists and when exactly to call it ;-) |
Beta Was this translation helpful? Give feedback.
-
But note that no error will be propagated if the user supplier recover from the failure. Like in the example from the guide. In that scenario, if they want to use the session, they need something like:
|
Beta Was this translation helpful? Give feedback.
-
In my understanding this open issue makes it implossible to use quarkus in a reactive way with hibernate. I'm a bit surprised, it looks like no one else has this problem. Is there some kind of workaround I‘ve missed? |
Beta Was this translation helpful? Give feedback.
-
For the record - the Something like the this can be used instead: // ...
.onFailure()
.recoverWithUni(t ->
Panache.getSession()
.chain(s -> s.close()) // close the current session
.chain(v -> Panache.withSession(() -> doSomeRecoveryWithNewSession())
); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, a new
Mutiny.Session
is created per request, i.e. theReactiveSessionProducer.createMutinySession()
producer method is@RequestScoped
. This bean is then used byPanacheEntity
. However, if "the session is considered to be unusable after any of its methods throws an exception" - Using the reactive session. This may lead to unexpected errors if a user attempts to use aPanacheEntity
e.g. after an unsuccessful flush operation...I wonder if a transaction rollback should result in the
ReactiveSessionProducer.createMutinySession()
bean destruction?FTR there are several ways to destroy a bean explicitly. In Quarkus, you can do e.g.
Arc.container().instance(Mutiny.Session.class).destroy()
.Beta Was this translation helpful? Give feedback.
All reactions