Skip to content

Instantly share code, notes, and snippets.

@andromedarabbit
Created July 24, 2015 16:41
Show Gist options
  • Save andromedarabbit/857ddd7ecc2fc838bc7e to your computer and use it in GitHub Desktop.
Save andromedarabbit/857ddd7ecc2fc838bc7e to your computer and use it in GitHub Desktop.
TransactionManager
@Inject
private PlatformTransactionManager transactionManager;
private void someMethod(boolean roolback) {
TransactionStatus transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());
// Do something
if (rollback) {
transactionManager.rollback(transactionStatus);
return;
}
transactionManager.commit(transactionStatus);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment