I have the following code (OLE = OptimisticLockException)...
public void outer() {
try {
middle()
} catch (OLE) {
updateEntities();
outer();
}
}
@Transactional
public void middle() {
try {
inner()
} catch (OLE) {
updateEntities();
middle();
}
@Transactional
public void inner() {
}
inner()caused by other non-transactional method, so the two middle()and inner()are transactional. As you can see, I do OLE by updating objects and repeating the operation.
The problem I am facing is that when I designed such things, I assumed that the only time OLE could be obtained was that the transaction was closed. This is apparently not the case, as inner()OLE throws the call , even when the stack is outer()->middle()->inner().
middle() OLE, , , rollbackOnly Spring. middle(), , , , rollbackOnly.
, . rollbackOnly. , . - , - , -?
EDIT: , , . OLE, @Transactional?
FYI: JpaTransactionManager, JPA - .