Search in sources :

Example 1 with NutTxDao

use of org.nutz.dao.impl.NutTxDao in project nutz by nutzam.

the class SimpleDaoTest method test_nutz_tx_dao.

@Test
public void test_nutz_tx_dao() throws Throwable {
    for (int i = 0; i < 1000; i++) {
        NutTxDao tx = new NutTxDao(dao);
        try {
            tx.beginRC();
            tx.query(Pet.class, null);
            tx.commit();
        } catch (Throwable e) {
            tx.rollback();
            throw e;
        } finally {
            tx.close();
        }
    }
}
Also used : NutTxDao(org.nutz.dao.impl.NutTxDao) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 NutTxDao (org.nutz.dao.impl.NutTxDao)1