Hello, everyone!
There are two classes:
Output:Code:@Component public class A { @Autowired private B b; @Autowired private DefaultJdbcTemplate jdbcTemplate; @Transactional public void doA() { System.out.println("1. txid: " + jdbcTemplate.queryForObject("select txid_current()", String.class)); b.doB(); System.out.println("3. txid: " + jdbcTemplate.queryForObject("select txid_current()", String.class)); } } @Component public class B { @Autowired private DefaultJdbcTemplate jdbcTemplate; @Transactional(propagation=Propagation.REQUIRES_NEW) public void doB() { System.out.println("2. txid: " + jdbcTemplate.queryForObject("select txid_current()", String.class)); } }
1. txid: 42714642
2. txid: 42714669
3. txid: 42714677
Statements #1 and #3 are executed in different transactions. Is that a normal behavior? I'm using postgres and JtaTransactionManager.
Thanks.


Reply With Quote
