Search in sources :

Example 6 with ConnectionParam

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

the class EclipseLinkBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam connParam = new ConnectionParam();
    connParam.db = db;
    connParam.init();
    sf = Persistence.createEntityManagerFactory("jpa");
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam)

Example 7 with ConnectionParam

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

the class HibernateBenchmark 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 MappedObject4 s");
        query.setMaxResults(2);
        List<?> sr = query.getResultList();
        for (Object o : sr) {
            System.out.println(o.toString());
        }
    } finally {
        session.close();
    }
}
Also used : EntityManager(javax.persistence.EntityManager) Query(javax.persistence.Query) EntityManagerFactory(javax.persistence.EntityManagerFactory) ConnectionParam(org.simpleflatmapper.db.ConnectionParam)

Example 8 with ConnectionParam

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

the class HibernateBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam connParam = new ConnectionParam();
    connParam.db = db;
    connParam.init();
    sf = Persistence.createEntityManagerFactory("jpa");
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam)

Example 9 with ConnectionParam

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

the class Sql2OSfmBenchmark method main.

public static void main(String[] args) throws SQLException, NamingException {
    ConnectionParam connParam = new ConnectionParam();
    connParam.db = DbTarget.H2;
    connParam.init();
    Sql2o sql2o = new Sql2o(connParam.dataSource);
    org.sql2o.Connection conn = sql2o.open();
    Map<String, String> columnMappings = new HashMap<>();
    columnMappings.put("YEAR_STARTED", "yearStarted");
    SfmResultSetHandlerFactoryBuilder builder = new SfmResultSetHandlerFactoryBuilder();
    builder.setColumnMappings(columnMappings);
    ResultSetHandlerFactory<MappedObject16> factory16 = builder.newFactory(MappedObject16.class);
    try {
        ResultSetIterable<MappedObject16> resultSetIterable = conn.createQuery(Sql2OBenchmark.SELECT_OBJECT16).addParameter("limit", 2).executeAndFetchLazy(factory16);
        for (MappedObject16 o : resultSetIterable) {
            System.out.println("o = " + o);
        }
    } finally {
        conn.close();
    }
}
Also used : MappedObject16(org.simpleflatmapper.beans.MappedObject16) HashMap(java.util.HashMap) ConnectionParam(org.simpleflatmapper.db.ConnectionParam) SfmResultSetHandlerFactoryBuilder(org.simpleflatmapper.sql2o.SfmResultSetHandlerFactoryBuilder) Sql2o(org.sql2o.Sql2o)

Example 10 with ConnectionParam

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

the class Sql2OSfmBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam connParam = new ConnectionParam();
    connParam.db = db;
    connParam.init();
    sql2o = new Sql2o(connParam.dataSource);
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam) Sql2o(org.sql2o.Sql2o)

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