Skip to main content

Posts

Showing posts from April, 2018

Spring Transactions

2. Configure Transactions without XML Spring 3.1 introduces  the  @EnableTransactionManagement  annotation  to be used in on  @Configuration  classes and enable transactional support: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 With transactions configured, a bean can now be annotated with @Transactional either at the class or method level: 1 2 3 4 5 @Service @Transactional public class FooService {      //... } The annotation supports  further configuration  as well: the  Propagation Type  of the transaction the  Isolation Level  of the transaction a  Timeout  for the operation wrapped by the transaction a  readOnly  flag  – a hint for the persistence provider that the transaction should be read only the  Rollback  rules for the transaction Note that – by default, rollback happens ...