我试图以这种方式删除并在我的数据存储区中创建相同的对象(但是使用新的模式)(我为使用队列的每个对象重复此过程):
// ... more code
try {
tx = pm.currentTransaction();
tx.begin();
// Deleting the old object
pm.deletePersistent(pm.getObjectById(Expediente.class, old.getKey().getId()));
tx.commit();
} catch (Exception ex) {
if (tx.isActive()) {
tx.rollback();
}
}finally{
pm.close();
}
pm = PMF.get().getPersistenceManager();
try {
tx = pm.currentTransaction();
tx.begin();
// Setting the new object
pm.makePersistent(newObject);
tx.commit();
} catch (Exception ex) {
if (tx.isActive()) {
tx.rollback();
}
}finally{
pm.close();
}
好的,它工作正常,但有时,随机,我得到此错误,对象不会更改。有什么建议吗?
PM org.datanucleus.transaction.Transaction commit Grave:资源上的操作提交失败:com.google.appengine.datanucleus.DatastoreXAResource@4d621f11,错误代码UNKNOWN和事务:[DataNucleus Transaction,ID = Xid =