I'm using @Transactional in my service layer. If I annotate two updating service methods with @Transactional (using default settings) and a controller method is calling both of these methods to perform its action, do both service methods use the same transaction?
It appears that they do not, and I am looking for confirmation of this. It would appear to me that to get both methods to use the same transaction I would need to write a third method in the service, annotate it with @Transactional, and call the original two methods from there.
everything you said is correct, including how to get around the issue. It might be a good time to implement a Facade service that coordinates all your other services. That way the the used services will participate in the transactions of the Facade service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With