use of org.datanucleus.exceptions.RollbackStateTransitionException in project datanucleus-core by datanucleus.
the class ExecutionContextImpl method preRollback.
/**
* Rollback any changes made to objects managed by the object manager to the database.
*/
public void preRollback() {
List<Exception> failures = null;
try {
Collection<ObjectProvider> ops = enlistedOPCache.values();
Iterator<ObjectProvider> opsIter = ops.iterator();
while (opsIter.hasNext()) {
ObjectProvider op = opsIter.next();
try {
op.preRollback(getTransaction());
} catch (RuntimeException e) {
if (failures == null) {
failures = new ArrayList();
}
failures.add(e);
}
}
clearDirty();
} finally {
resetTransactionalVariables();
}
if (failures != null && !failures.isEmpty()) {
throw new RollbackStateTransitionException(failures.toArray(new Exception[failures.size()]));
}
if (getBooleanProperty(PropertyNames.PROPERTY_DETACH_ALL_ON_ROLLBACK)) {
// "detach-on-rollback"
performDetachAllOnTxnEndPreparation();
}
}
Aggregations