事务正在被代码反映成功回滚。但是,在事务中执行的操作没有反映到数据库中,并且没有回滚到tx的非提交活动状态,即使用tx删除记录时(事务) PMF和DynaPMF回滚用于撤消操作不起作用。
这里PMF,DynaPMF为两个不同的数据库引用2个不同的PersistanceMangerFactory
if (isTransactionLocal || (PMF.getTransactionCounter() > 0 || DynaPMF.getTransactionCounter() > 0)) {
//tx.rollback();
if(PMF.getPerThreadTransaction()!=null){
tx=PMF.getPerThreadTransaction();
System.err.println(tx.hashCode()+"transaction thread is Alive =>"+tx.isActive());
if(tx.isActive()){
tx.rollback();
System.err.println("rollback for tx = "+tx.hashCode()+" done .");
}
}
if(DynaPMF.getPerThreadTransaction()!=null){
tx=DynaPMF.getPerThreadTransaction();
System.err.println(tx.hashCode()+"transaction thread is Alive =>"+tx.isActive());
if(tx.isActive()){
tx.rollback();
System.err.println("rollback for tx = "+tx.hashCode()+" done .");
}
}
PMF.setPerThreadTransaction(null);
DynaPMF.setPerThreadTransaction(null);
输出:
1861140113transaction thread is Alive =>true
rollback for tx = 1861140113 done .
336180090transaction thread is Alive =>true
rollback for tx = 336180090 done .
它在代码中显示回滚发生成功,但没有反映在数据库中。
答案 0 :(得分:0)
根据JDO回滚,只能对那些在JDO生命周期中具有持久清理状态的对象执行回滚,这可以从 https://db.apache.org/jdo/state_transition.html 并且从其他状态回滚无法反映到数据存储区。