use of org.jdbi.v3.core.Handle in project jdbi by jdbi.
the class TestModifiers method setUp.
@Before
public void setUp() throws Exception {
handle = dbRule.getSharedHandle();
handle.registerRowMapper(new SomethingMapper());
}
use of org.jdbi.v3.core.Handle in project jdbi by jdbi.
the class TestReadOnly method testReadOnlyInner.
@Test
public void testReadOnlyInner() {
try (Handle h = db.openHandle()) {
RODao dao = h.attach(RODao.class);
dao.writeTxn(() -> dao.readTxn(() -> {
}));
}
}
use of org.jdbi.v3.core.Handle in project jdbi by jdbi.
the class TestReadOnly method testReadOnlyOuter.
@Test(expected = TransactionException.class)
public void testReadOnlyOuter() {
try (Handle h = db.openHandle()) {
RODao dao = h.attach(RODao.class);
dao.readTxn(() -> dao.writeTxn(() -> {
}));
}
}
use of org.jdbi.v3.core.Handle in project jdbi by jdbi.
the class TestReadOnly method testHandleReadOnly.
@Test
public void testHandleReadOnly() throws Exception {
try (Handle h = db.openHandle()) {
assertThat(h.isReadOnly()).isFalse();
assertThat(h.getConnection().isReadOnly()).isFalse();
h.setReadOnly(true);
assertThat(h.isReadOnly()).isTrue();
assertThat(h.getConnection().isReadOnly()).isTrue();
}
}
use of org.jdbi.v3.core.Handle in project jdbi by jdbi.
the class TestReentrancy method testGetHandleProvidesSeperateHandle.
@Test(expected = UnableToCreateStatementException.class)
public void testGetHandleProvidesSeperateHandle() throws Exception {
final TheBasics dao = db.onDemand(TheBasics.class);
Handle h = dao.getHandle();
h.execute("insert into something (id, name) values (1, 'Stephen')");
}
Aggregations