-
-
Notifications
You must be signed in to change notification settings - Fork 260
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: nested NOT_SUPPORTED transaction with an inner REQUIRES transaction #3288
base: master
Are you sure you want to change the base?
Conversation
*/ | ||
private ScopedTransaction activeScoped() { | ||
return (ScopedTransaction) scopeManager.active(); | ||
} |
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.
not longer in use
@@ -499,7 +492,7 @@ public final ScopedTransaction externalBeginTransaction(SpiTransaction transacti | |||
*/ | |||
public final ScopedTransaction beginScopedTransaction(TxScope txScope) { | |||
txScope = initTxScope(txScope); | |||
ScopedTransaction txnContainer = activeScoped(); | |||
ScopedTransaction txnContainer = (ScopedTransaction) inScope(); |
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.
is it possible (or allowed) that we will get an instance not implementing ScopedTransaction
here?
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.
if a DB.save(entityWithPersistAction)
creates an implicit transaction, we will fail here, if a callback or @PrePersist
action tries to create a nested transaction, because implicit transactions are not nestable
Hmm. There are still some issues, when ebean tries to open some implicit transactions. I've tried to start fixing it here: 38b5ac2 but I think this will go into the wrong direction. So the question is: Means "NOT_SUPPORTED" really: Pause current transaction and behave like never a transaction was opened Note: As workaround we currently experiment with: try (Transaction txn = DB.beginTransaction()) {
// find status
Thread t = new Thread(()-> { /* runs without txn */});
t.start();
t.join();
// update status
} |
Hello Rob, we discovered a strange behaviour, when using NOT_SUPPORTED transaction.
We have some import code in our application Our use case is as follow:
This works fine, as long the "runImport" will not open new transactions. In this case, the next
DB.beginTransaction()
will not detect the open stack oftxn1
andtxn2
and will effectively overwrite the existing txnContainer.