我在一个方法中执行如下语句:
try {
this.client.startTransaction();
this.client.insert("insertStudent", student);
this.client.insert("insertStudent", student);
ProcessManager.deployIgnoreCreator("testSnaker.snaker");
//int a = 1/0;
this.client.commitTransaction();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
this.endTransaction(client);
}
在ProcessManager.deployIgnoreCreator("testSnaker.snaker");方法中,是调用client.getDataSource().getConnection()获得connection对象,然后用该对象操作数据库,我如何通过事务,保证这三个操作数据库语句的原子性呢?