FIX: nested NOT_SUPPORTED transaction with an inner REQUIRES transaction#3288
FIX: nested NOT_SUPPORTED transaction with an inner REQUIRES transaction#3288rPraml wants to merge 3 commits intoebean-orm:masterfrom
Conversation
| */ | ||
| private ScopedTransaction activeScoped() { | ||
| return (ScopedTransaction) scopeManager.active(); | ||
| } |
| public final ScopedTransaction beginScopedTransaction(TxScope txScope) { | ||
| txScope = initTxScope(txScope); | ||
| ScopedTransaction txnContainer = activeScoped(); | ||
| ScopedTransaction txnContainer = (ScopedTransaction) inScope(); |
There was a problem hiding this comment.
is it possible (or allowed) that we will get an instance not implementing ScopedTransaction here?
There was a problem hiding this comment.
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 oftxn1andtxn2and will effectively overwrite the existing txnContainer.