java - Just update/insert into DB when there are no errors (@Transactional(propagation = Propagation.REQUIRED)) -


i have business class calls 6 services. depending dto treated every moment, different service called.

theoretically every time business class called call these 6 services.

i want if there no errors in these 6 services updates done meanwhile commited database.

in case there errors no commit must done database.

theoretically have planned in applying business class calls 6 services , 6 services called:

@transactional(propagation = propagation.required) 

is ok?would in different way?

thank you

this sounds want do.

assuming each of 6 services throws exception if goes wrong.

you can test putting breakpoints 6 services, check in debugger's stacktrace transaction advice , check 6 services use same transaction object (they should). if trigger exception in 1 of services, transaction should marked rollback.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -