PlatformTransactionManager ptm = new DataSourceTransactionManager(this.getDataSource());
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
TransactionStatus status = ptm.getTransaction(def);
try {
String _deleteSql = "delete from sdc_StockIndustryRela where industryCode='" + industrycode + "' and relationtype=" + partmode;
getJdbcTemplate().execute(_deleteSql);
String _deleteIndustrySql = "delete from sdc_industrypartition where partmode=" + partmode + " and industrycode like '" + industrycode + "%'";
getJdbcTemplate().execute(_deleteIndustrySql);
ptm.commit(status);
} catch (Exception e) {
ptm.rollback(status);
}
Spring 纯jdbc JdbcDaoSupport 事务处理
最新推荐文章于 2020-08-04 17:15:09 发布