Preconditions
- Database batch processing is enabled
- The execution of a job failed so it has a reference to a byte array containing the stacktrace
Steps to reproduce
- In TX1 the job is changed
- In TX2 the job should be deleted
- To avoid foreign key constraint violations, the job record itself is deleted first and afterwards the byte array belonging to the job is deleted
- TX1 and TX2 are flushed
- Since the job record was changed in TX1 first, an OptimisticLockingException occurs in the first batch of TX2
Observed behavior
- The OptimisticLockingException thrown when trying to delete the job is swallowed
- The byte array cannot be deleted since the job record is still present
- This leads to a foreign key constraint violation
Expected behavior
The OptimisticLockingException is thrown.