Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
- public Status newTransactionTest() {
- logger.info("newTransactionTest() INNER");
- Company company = companyDAO.findOne(10000013);
- company.setName(company.getName() + "X");
- return Status.OK;
- }
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public Status test() {
- logger.info("test() BEFORE");
- Company company1 = companyDAO.findOne(10000013);
- String before = company1.getName();
- // run in a new transaction
- applicationContext.getBean(beanName, AdminService.class).newTransactionTest();
- logger.info("test() AFTER");
- Company company2 = companyDAO.findOne(10000013);
- String after = company2.getName();
- logger.info("COMPANY NAME BEFORE: " + before);
- logger.info("COMPANY NAME AFTER: " + after);
- return Status.OK;
- }
- test() BEFORE
- connection: 122 select company0_.name as name7_4_0_ ... where company0_.id=5000062
- newTransactionTest() INNER
- connection: 123 select company0_.name as name7_4_0_ ... where company0_.id=5000062
- connection: 123 update Company set name='TestorexX' where id=5000062
- connection: 123 commit
- test() AFTER
- connection: 122 select company0_.name as name7_4_0_ ... where company0_.id=5000062
- COMPANY NAME BEFORE: Testorex
- COMPANY NAME AFTER: Testorex
- SHOW VARIABLES WHERE Variable_name ='tx_isolation'
- <property name="hibernate.connection.isolation">2</property>
- 1: READ UNCOMMITTED
- 2: READ COMMITTED
- 4: REPEATABLE READ
- 8: SERIALIZABLE
- SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement