Skip to content

Tag: transactional

Spring: automatic rollback on checked exceptions

One way to configure Spring to rollback on a non RuntimeExceptions is using @Transactional(rollbackFor=…) annotation on the service classes. The problem with this approach is that we need to define (rollbackFor=…) for almost all the service classes which seems really redundant. My question: Is there any way to configure a default behaviour for Spring transaction manager to rollback on a

Why we shouldn’t make a Spring MVC controller @Transactional?

There are already a few questions about the topic, but no response at all really provides arguments in order to explain why we shouldn’t make a Spring MVC controller Transactional. See: Transaction not working correctly – Spring/MyBatis For web MVC Spring app should @Transactional go on controller or service? Making Spring 3 MVC controller method Transactional Spring MVC Controller Transactional