I'm experiencing a transaction conflict I couldn't solve so far.
Let's say I have at controller level two methods: startTesting() and interruptTesting(), doing following:
startTesting() //(read and write):
- fetch a testRun from the DB
- read a property "running"
- if (running == true), execute testRun (meaning: updating the object testRun)
interruptTesting() //(read and write):
- fetch the same Testrun
- set the property "running" to false
Problem: it looks like within the execution of startTesting(), the method cannot access to the testRun updated by interruptTesting() and with property running set to false.
Transactional settings:
There are no explicit @Transactional annotation wrapping startTesting() nor interruptTesting().
In our application spring.jpa.open-in-view is enabled. I read that this is considered as anti-pattern. But since the application is soon end of life, I'm a bit reluctant to take the risk to change this setting now without being sure about the consequences in other parts of the application.
Does anyone have an hint how one should handle the transactions in such a case?