private PlatformTransactionManager txnMgr;
/**
* Spring IoC method
* @param value The injected value.
* @spring.property ref="transactionManager"
*/
public void setTransactionManager(PlatformTransactionManager value) {
txnMgr = value;
}
public void doSomething() {
TransactionTemplate tt = new TransactionTemplate(txnMgr);
tt.setPropagationBehavior(
TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
tt.setTimeout(500);
Object result = tt.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
// transactional code goes here
}
});
}