|
Transactions
Managing transactions with SimpleDS
TransactionsTransactions as included in Google AppEngine are supported: try {
Transaction tx = entityManager.beginTransaction();
entityManager.put(tx, instance);
entityManager.put(tx, instance.getKey(), childCollection);
tx.commit();
} catch (RuntimeException e) {
tx.rollback();
throw e;
}Transparent transactionsYou can use @Transactional to save yourself the hassle of committing/rolling back transactions: @Transactional
public void save(FooBar foobar, Baz baz) {
entityManager.put(entityManager.beginTransaction(), ImmutableList.of(foobar, baz));
mailService.sendConfirmation("Operation completed successfully");
}The transaction will be rolled back on any exception, or commmit otherwise. To enable this you should add a TransactionInterceptor aspect to your application config. |
► Sign in to add a comment