This tutorial demonstrates the use of declarative transaction management within a Spring Boot 2 application via local transaction management using annotation based configuration with the Nested Propagation Level.
If you don't know what Nested Transactions or why we use them then this is the perfect tutorial for you. I take a Spring Boot 2 application and simulate loading spacecraft timed commands
into the satellite's database via nested transactions. Spring's JDBC Template is used in a @Transactional context and persists the data into a H2 embedded database. This tutorial
demonstrates the use of the DataSourceTransactionManager which supports Nested Transactions out of the box with Spring Boot.
Spring has always supported the standard 6 transaction propagation levels whose names are analogous to those in EJB land. They are specified below and can be inserted directly with the following @Transactional annotation.
@Transactional(propagation = Propagation.**SEE LIST BELOW**)
REQUIRED (* default)
REQUIRES_NEW
SUPPORTS
NOT_SUPPORTED
MANDATORY
NEVER
There is however one more, a 7th propagation level that not many know about and that is the NESTED transaction propagation level. Unfortunately it’s not supported by all transaction managers and it is easily confused with REQUIRES_NEW.
We will explore the
@Transactional(propagation = Propagation.NESTED) syntax and I'll explain the difference that Nested Transactions have with the other REQUIRES_NEW Propagation Level.
Read the blog post "Spring Nested Transactions" here ...
http://mvpjava.com/spring-nested-tran...
The Project/demo Source code is available on MVP Java's GitHub account here ...
https://github.com/mvpjava/spring-nes...
Just git clone ...
"git clone https://github.com/mvpjava/spring-nes..."
DON'T CLICK THIS!!! http://bit.ly/2UmF76l
======================================================
Subscribe to MVP Java ...
https://www.youtube.com/c/MVPJava?sub...
Follow me ...
Website : http://www.mvpjava.com
Facebook : / mvpjava
Twitter : / mvpjava
GitHub : https://github.com/mvpjava
DockerHub: https://hub.docker.com/?namespace=mvp...
My company www.triomni-it.com