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");
}
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();
}
}
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");
}
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();
}
}
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);
}
Aggregations