Skip to content
Advertisement

Tag: spring-transactions

Spring @Transactional with base and subclasses

I am confused about @Transactional annotation with base and subclasses. I have the following code with several generic subclasses derived from the base class CustomRepository<T> which implements ICustomRepository<T>. I want all the methods of the interface ICustomRepository<T> be transactional. Is it enough to put @Transactional just in the base class so that the call findAll() from sublasses also become transactional.

Overriding transaction propagation levels for methods having Spring’s @transactional

I have multiple methods in my codebase annotated with Spring’s @transactional with different propgation levels (lets ignore the idea behind choosing the propagation levels). Example – Now I have a new use case where I want to perform all these operations in a single transaction (for this specific use case only, without modifying existing behavior), overriding any annotated propagation levels.

Advertisement