Skip to content
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

Implement Propagation for nested transaction #611

Open
Tapac opened this issue Jul 24, 2019 · 2 comments
Open

Implement Propagation for nested transaction #611

Tapac opened this issue Jul 24, 2019 · 2 comments

Comments

@Tapac
Copy link
Contributor

Tapac commented Jul 24, 2019

Something similar to
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Propagation.html

@bastman
Copy link

bastman commented Aug 22, 2019

@Tapac is there a way to ...

  1. suspend the current transaction
  2. create a new transaction -> (force) commit the new transaction
  3. resume the initial transaction

Currently, I struggle with that. It might be similar the spring TransactionPropagation.REQUIRES_NEW .

My current use case (pseudo code) ...

fun handle() {

outer= transaction.start()
Try {
   outer.exec(some sql)
   
  Try {
      inner = transaction.start()
      inner.exec(sql)
      inner.commit()
  }

}
.onSuccess() { outer.commit() }

.onFailure() { outer.rollback() } // outer: rollback, but inner should be commited.

}

Thanks a lot for your help :)

@nimanakov
Copy link

I was trying to commit nested transaction with set up useNestedTransactions == true for Database but that did not work. This indeed is nice to have feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants