Wednesday, March 18, 2020

Transaction management in Spring

As we can read on DZONE we should be aware of some misunderstanding of the transaction management mechanism in Spring:
https://dzone.com/articles/how-does-spring-transactional

@Transactional(isolation = Isolation.SERIALIZABLE)
How does @Transactional annotation work?
The persistence context proxy that implements EntityManager is not the only component needed for making declarative transaction management work.
3 separate components are needed:
  1. the EntityManager Proxy
  2. the Transactional Aspect
  3. the Transaction Manager

The Spring declarative transaction management mechanism is very powerful, but it can be misused or wrongly configured easily.

Understanding how it works internally is helpful when troubleshooting situations when the mechanism is not at all working or is working in an unexpected way.

Read more, if You need at https://dzone.com/articles/how-does-spring-transactional

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html

https://www.baeldung.com/transaction-configuration-with-jpa-and-spring  (@EnableTransactionManagement)

https://docs.spring.io/spring-framework/docs/current/javadoc-api/overview-summary.html


No comments: