use of jodd.db.jtx.DbJtxTransaction in project jodd by oblac.
the class DbTransactionTest method service1.
// service #1 REQUIRED
JtxTransaction service1() {
assertTotals(0, 0);
DbJtxTransaction tx = dbtxm.requestTransaction(new JtxTransactionMode().propagationRequired());
assertTotals(1, 1);
s1 = tx.requestResource();
return tx;
}
use of jodd.db.jtx.DbJtxTransaction in project jodd by oblac.
the class DbTransactionTest method service3_1.
// service #3_1 NOT SUPPORTED
void service3_1(JtxTransaction tx3) {
assertTotals(1, 1);
DbJtxTransaction tx = dbtxm.requestTransaction(new JtxTransactionMode().propagationNotSupported());
assertNotSame(tx3, tx);
assertTotals(2, 1);
assertNotSame(s1, tx.requestResource());
assertNotSame(s1, tx.requestResource());
tx.commit();
assertTotals(1, 1);
}
use of jodd.db.jtx.DbJtxTransaction in project jodd by oblac.
the class DbTransactionTest method service3.
// service #3 REQUIRED
void service3(JtxTransaction tx1) {
assertTotals(1, 1);
DbJtxTransaction tx = dbtxm.requestTransaction(new JtxTransactionMode().propagationRequired());
assertEquals(tx1, tx);
assertTotals(1, 1);
assertEquals(s1, tx.requestResource());
service3_1(tx);
assertEquals(s1, tx.requestResource());
assertTotals(1, 1);
}
use of jodd.db.jtx.DbJtxTransaction in project jodd by oblac.
the class DbTransactionTest method service2.
// service #2 REQUIRES NEW
void service2(JtxTransaction tx1) {
assertTotals(1, 1);
DbJtxTransaction tx = dbtxm.requestTransaction(new JtxTransactionMode().propagationRequiresNew());
assertTotals(2, 2);
assertNotSame(tx1, tx);
assertNotSame(s1, tx.requestResource());
tx.commit();
assertTotals(1, 1);
}
use of jodd.db.jtx.DbJtxTransaction in project jodd by oblac.
the class DbTransactionTest method service0.
void service0() {
assertTotals(0, 0);
DbJtxTransaction tx = dbtxm.requestTransaction(new JtxTransactionMode().propagationRequired());
assertTotals(1, 1);
s0 = tx.requestResource();
service0_1(tx);
tx.commit();
assertTotals(0, 0);
}
Aggregations