Search in sources :

Example 1 with ConnectionParam

use of org.simpleflatmapper.db.ConnectionParam in project mapping-benchmark by arnaudroger.

the class JooqMapperBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam cp = new ConnectionParam();
    cp.db = db;
    cp.init();
    dsl = DSL.using(new DefaultConfiguration().set(cp.dataSource).set(getSqlDialect(db)));
    select4 = dsl.selectFrom(TestSmallBenchmarkObject.TEST_SMALL_BENCHMARK_OBJECT);
    select16 = dsl.selectFrom(TestBenchmarkObject_16.TEST_BENCHMARK_OBJECT_16);
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam) DefaultConfiguration(org.jooq.impl.DefaultConfiguration)

Example 2 with ConnectionParam

use of org.simpleflatmapper.db.ConnectionParam in project mapping-benchmark by arnaudroger.

the class JooqSfmBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam cp = new ConnectionParam();
    cp.db = db;
    cp.init();
    dsl = DSL.using(new DefaultConfiguration().set(cp.dataSource).set(JooqMapperBenchmark.getSqlDialect(db)).set(new SfmRecordMapperProvider()));
    select4 = dsl.selectFrom(TestSmallBenchmarkObject.TEST_SMALL_BENCHMARK_OBJECT);
    select16 = dsl.selectFrom(TestBenchmarkObject_16.TEST_BENCHMARK_OBJECT_16);
}
Also used : SfmRecordMapperProvider(org.simpleflatmapper.jooq.SfmRecordMapperProvider) ConnectionParam(org.simpleflatmapper.db.ConnectionParam) DefaultConfiguration(org.jooq.impl.DefaultConfiguration)

Example 3 with ConnectionParam

use of org.simpleflatmapper.db.ConnectionParam in project mapping-benchmark by arnaudroger.

the class BatooBenchmark method main.

public static void main(String[] args) throws Exception {
    ConnectionParam connParam = new ConnectionParam();
    connParam.db = DbTarget.HSQLDB;
    connParam.init();
    EntityManagerFactory sf = Persistence.createEntityManagerFactory("jpa");
    EntityManager session = sf.createEntityManager();
    try {
        Query query = session.createQuery("select s from MappedObject16 s");
        query.setMaxResults(2);
        List<MappedObject16> sr = query.getResultList();
        for (MappedObject16 o : sr) {
            System.out.println("o. = " + o.getEmail());
            System.out.println("o. = " + o.getField12());
        }
    } finally {
        session.close();
    }
}
Also used : EntityManager(javax.persistence.EntityManager) MappedObject16(org.simpleflatmapper.jpa.beans.MappedObject16) Query(javax.persistence.Query) EntityManagerFactory(javax.persistence.EntityManagerFactory) ConnectionParam(org.simpleflatmapper.db.ConnectionParam)

Example 4 with ConnectionParam

use of org.simpleflatmapper.db.ConnectionParam in project mapping-benchmark by arnaudroger.

the class JooqRecordBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam cp = new ConnectionParam();
    cp.db = db;
    cp.init();
    dsl = DSL.using(new DefaultConfiguration().set(cp.dataSource).set(JooqMapperBenchmark.getSqlDialect(db)));
    select4 = dsl.selectFrom(TestSmallBenchmarkObject.TEST_SMALL_BENCHMARK_OBJECT);
    select16 = dsl.selectFrom(TestBenchmarkObject_16.TEST_BENCHMARK_OBJECT_16);
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam) DefaultConfiguration(org.jooq.impl.DefaultConfiguration)

Example 5 with ConnectionParam

use of org.simpleflatmapper.db.ConnectionParam in project mapping-benchmark by arnaudroger.

the class JooqRecordBenchmark method main.

public static void main(String[] args) throws SQLException, NamingException {
    ConnectionParam cp = new ConnectionParam();
    cp.db = DbTarget.H2;
    cp.init();
    DSLContext dsl = DSL.using(new DefaultConfiguration().set(cp.dataSource).set(SQLDialect.H2));
    dsl.selectFrom(TestSmallBenchmarkObject.TEST_SMALL_BENCHMARK_OBJECT).limit(2).forEach(System.out::println);
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam) DefaultConfiguration(org.jooq.impl.DefaultConfiguration)

Aggregations

ConnectionParam (org.simpleflatmapper.db.ConnectionParam)18 DefaultConfiguration (org.jooq.impl.DefaultConfiguration)6 EntityManager (javax.persistence.EntityManager)3 EntityManagerFactory (javax.persistence.EntityManagerFactory)3 Query (javax.persistence.Query)3 SfmRecordMapperProvider (org.simpleflatmapper.jooq.SfmRecordMapperProvider)3 Sql2o (org.sql2o.Sql2o)3 HashMap (java.util.HashMap)1 Setup (org.openjdk.jmh.annotations.Setup)1 MappedObject16 (org.simpleflatmapper.beans.MappedObject16)1 MappedObject4 (org.simpleflatmapper.beans.MappedObject4)1 TestSmallBenchmarkObjectRecord (org.simpleflatmapper.beans.tables.records.TestSmallBenchmarkObjectRecord)1 MappedObject16 (org.simpleflatmapper.jpa.beans.MappedObject16)1 SfmResultSetHandlerFactoryBuilder (org.simpleflatmapper.sql2o.SfmResultSetHandlerFactoryBuilder)1