I have a case when a transaction is started and a method is called along the path (in the code) that starts a new transaction. When the internal transaction is completed, the data is stored in the database, but the data is not visible from the external transaction.
Here are the code snippets.
@Transactional(readOnly = true)
public void doSomething() {
doMoreStuff();
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void doMoreStuff() {
...
}
The doMoreStuff method updates some data in the database, after which the doSomething method should see the updated data, but this is not so. For example, "doMoreStuff" sets a boolean value from false to true and saves it. The doSomething method still only sees false.
Any suggestions?
source
share