I am studying how to Spring handle transaction and I am asking what happens if one @Transactional
annotated method is calling another @Transactional
annotated method on the same object instance?
I know that the transactional propagation defaul level is REQUIRED
so if I have a method1()
annotated with @Transactional
of an instance of MyObject
that call a method2()
(annotated with @Transactional
) of the same instance I think that, following the REQUIRED
level, it is performed on the same transaction created by method1()
.
Is it my reasoning correct or am I missing something? I am not sure about what exactly happens if the 2 @Transactional
methods are called on the same instance.
How it works?