Search in sources :

Example 1 with LabelsRecord

use of org.simpleflatmapper.jooq.test.books.LabelsRecord in project SimpleFlatMapper by arnaudroger.

the class JooqUnmapperTest method testUnmapping.

@Test
public void testUnmapping() throws Exception {
    Connection conn = DbHelper.objectDb();
    Configuration cfg = new DefaultConfiguration().set(conn).set(SQLDialect.HSQLDB);
    cfg.set(JooqMapperFactory.newInstance().newRecordUnmapperProvider(new DSLContextProvider() {

        @Override
        public DSLContext provide() {
            return DSL.using(cfg);
        }
    }));
    DSLContext dsl = DSL.using(cfg);
    Label label = new Label(1, UUID.randomUUID(), "label", false);
    LabelsRecord labelsRecord = dsl.newRecord(Labels.LABELS, label);
    assertEquals(label.getId(), labelsRecord.getId());
    assertEquals(label.getName(), labelsRecord.getName());
    assertEquals(label.getUuid(), labelsRecord.getUuid());
    assertEquals(label.getObsolete(), labelsRecord.getObsolete());
}
Also used : DefaultConfiguration(org.jooq.impl.DefaultConfiguration) Configuration(org.jooq.Configuration) Connection(java.sql.Connection) Label(org.simpleflatmapper.jooq.test.books.Label) LabelsRecord(org.simpleflatmapper.jooq.test.books.LabelsRecord) DSLContext(org.jooq.DSLContext) DefaultConfiguration(org.jooq.impl.DefaultConfiguration) DSLContextProvider(org.simpleflatmapper.jooq.DSLContextProvider) Test(org.junit.Test)

Aggregations

Connection (java.sql.Connection)1 Configuration (org.jooq.Configuration)1 DSLContext (org.jooq.DSLContext)1 DefaultConfiguration (org.jooq.impl.DefaultConfiguration)1 Test (org.junit.Test)1 DSLContextProvider (org.simpleflatmapper.jooq.DSLContextProvider)1 Label (org.simpleflatmapper.jooq.test.books.Label)1 LabelsRecord (org.simpleflatmapper.jooq.test.books.LabelsRecord)1