return new JtxTransactionMode().propagationNotSupported().readOnly(false);
}
@Test
public void testNotSupported() {
LeanJtxWorker worker = new LeanJtxWorker(dbtxm);
DbJtxSessionProvider sessionProvider = new DbJtxSessionProvider(worker.getTransactionManager());
// session #1: not supported - commit
JtxTransaction jtx = worker.maybeRequestTransaction(notSupported(), CTX_1);
assertNotNull(jtx);
DbSession session = sessionProvider.getDbSession();
executeUpdate(session, "insert into GIRL values(1, 'Sophia', null)");
assertFalse(jtx.isActive());
assertTrue(jtx.isNoTransaction());
assertTrue(worker.maybeCommitTransaction(jtx));
assertFalse(jtx.isActive());
assertTrue(jtx.isCommitted());
// session #2: not supported - rollback
jtx = worker.maybeRequestTransaction(notSupported(), CTX_2);
assertNotNull(jtx);
session = sessionProvider.getDbSession();
assertFalse(jtx.isActive());
assertTrue(jtx.isNoTransaction());
executeUpdate(session, "insert into GIRL values(2, 'Gloria', null)");
assertTrue(worker.markOrRollbackTransaction(jtx, null));
// test
session = new DbSession(cp);
assertEquals(1, executeCount(session, "select count(*) from GIRL where id = 1"));
assertEquals(1, executeCount(session, "select count(*) from GIRL where id = 2"));