Affects: 5.3.20
Hi, I'm invoking a public method in a @Component annotated class. The method is annotated with the @Transactional annotation and is called externally from another bean. The method is responsible for creating different related entities on the db and the desired result is that if one of these entities fails to be saved then the entire process should be rolled back. The saving process is handled by Spring repositories. When testing the transactional process I'm willingly causing a javax.persistence.EntityExistsException however I cannot find any log proving a rollback process. On the other hand, I see logs stating that each individual saving operation is handled as belonging to an independent transaction (starting and completing per se; for instance, I always see this pair of logs:
- 2023-09-28 12:05:23.822 TRACE 36743 --- [ main] o.s.t.i.TransactionInterceptor : Getting transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]
- 2023-09-28 12:05:23.826 TRACE 36743 --- [ main] o.s.t.i.TransactionInterceptor : Completing transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save])
Is this the expected behaviour? Could it be related to any particular wrong configuration or should I try to check the transaction handling by activating other logs? Or is it effectively some kind of bug?
Please let me know
Comment From: sbrannen
We cannot assess whether it's a configuration error or a bug without actual code.
If you would like us to look into this, please provide a minimal sample application that we can run ourselves (preferably in a public repository on GitHub or a ZIP file attached to this issue).
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.