use of org.jooq.Configuration in project SimpleFlatMapper by arnaudroger.
the class SelectQueryMapperTest method testSelectQuery.
@Test
public void testSelectQuery() throws SQLException {
Connection conn = DbHelper.objectDb();
Configuration cfg = new DefaultConfiguration().set(conn).set(SQLDialect.HSQLDB);
DSLContext dsl = DSL.using(cfg);
SelectQueryMapper<Label> mapper = SelectQueryMapperFactory.newInstance().newMapper(Label.class);
UUID uuid1 = UUID.randomUUID();
Label label = new Label(1, uuid1, "l1", false);
dsl.insertInto(Labels.LABELS).columns(Labels.LABELS.ID, Labels.LABELS.NAME, Labels.LABELS.OBSOLETE, Labels.LABELS.UUID).values(1, "l1", false, uuid1).execute();
List<Label> labels = mapper.asList(dsl.select(Labels.LABELS.ID, Labels.LABELS.NAME, Labels.LABELS.OBSOLETE, Labels.LABELS.UUID).from(Labels.LABELS));
assertEquals(1, labels.size());
assertEquals(label, labels.get(0));
}
Aggregations