/**
* func description
*
* @author langkye
* @date 2099/12/31
*/
@Service
public class FuncServiceImpl {
@Resource
private org.springframework.jdbc.datasource.DataSourceTransactionManager dataSourceTransactionManager;
@Resource
private org.springframework.transaction.TransactionDefinition transactionDefinition;
public void someFunc() {
//手动开启事务
org.springframework.transaction.TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
try {
//do something...
//手动提交事务
//dataSourceTransactionManager.commit(transactionStatus);
} catch (Exception ex) {
//手动回滚事务
dataSourceTransactionManager.rollback(transactionStatus);
}
}
}