Spring boot, jdbc.
I feel a bit slippery when it comes to nested transaction..
Say there is MyService that uses MyRepository.
@Named
@Transactional(isolation=Isolation.READ_COMMITTED) // READ_COMMITTED < SERIALIZABLE
class MyService {
void do() {
myRepository.add(entity);
...
}
}
@Repository
class MyRepository {
@Transactional(propagation=Propagation.REQUIRED, isolation=Isolation.SERIALIZABLE)
void add(entity) {...}
}
Say, in this case i want to make sure that MyRepository takes care about the add() method, making sure it set a maximum level lock Isolation.SERIALIZABLE over the table it deals with.
I do not want anyone to override it, since it would lead to concurrency issues.
(same applies to propagation level)
Question:
In case of nested transaction, will transaction's of myService.do() override Isolation level of myRepository.add and maker it less strict ?
What are the precautions when dealing with nested transactions?