use of org.jdbi.v3.core.mapper.SomethingMapper 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.mapper.SomethingMapper in project jdbi by jdbi.
the class TestReducing method setUp.
@Before
public void setUp() {
Handle h = dbRule.getSharedHandle();
h.execute("CREATE TABLE something_location (id int, location varchar)");
h.execute("INSERT INTO something (id, name) VALUES (1, 'tree')");
h.execute("INSERT INTO something (id, name) VALUES (2, 'apple')");
h.execute("INSERT INTO something_location (id, location) VALUES (1, 'outside')");
h.execute("INSERT INTO something_location (id, location) VALUES (2, 'tree')");
h.execute("INSERT INTO something_location (id, location) VALUES (2, 'pie')");
h.registerRowMapper(new SomethingMapper());
}
use of org.jdbi.v3.core.mapper.SomethingMapper in project jdbi by jdbi.
the class TestRegisteredMappers method testRegisterInferredOnJdbi.
@Test
public void testRegisterInferredOnJdbi() throws Exception {
db.registerRowMapper(new SomethingMapper());
Something sam = db.withHandle(handle1 -> {
handle1.execute("insert into something (id, name) values (18, 'Sam')");
return handle1.createQuery("select id, name from something where id = :id").bind("id", 18).mapTo(Something.class).findOnly();
});
assertThat(sam.getName()).isEqualTo("Sam");
}
use of org.jdbi.v3.core.mapper.SomethingMapper in project jdbi by jdbi.
the class TestRegisteredMappersWork method testRegistered.
@Test
public void testRegistered() throws Exception {
dbRule.getSharedHandle().registerRowMapper(new SomethingMapper());
Spiffy s = dbRule.getSharedHandle().attach(Spiffy.class);
s.insert(1, "Tatu");
Something t = s.byId(1);
assertThat(t).isEqualTo(new Something(1, "Tatu"));
}
use of org.jdbi.v3.core.mapper.SomethingMapper in project jdbi by jdbi.
the class TestCreateSqlObjectAnnotation method setUp.
@Before
public void setUp() throws Exception {
dbRule.getJdbi().registerRowMapper(new SomethingMapper());
handle = dbRule.getSharedHandle();
handle.registerRowMapper(new SomethingMapper());
}
Aggregations