use of org.simpleflatmapper.beans.MappedObject16 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.beans.MappedObject16 in project mapping-benchmark by arnaudroger.
the class JdbcManualBenchmark method init.
@Setup
public void init() {
mapper4 = new RowMapper<MappedObject4>() {
@Override
public MappedObject4 map(ResultSet rs) throws Exception {
MappedObject4 o = new MappedObject4();
o.setId(rs.getLong(1));
o.setName(rs.getString(2));
o.setEmail(rs.getString(3));
o.setYearStarted(rs.getInt(4));
return o;
}
};
mapper16 = new RowMapper<MappedObject16>() {
@Override
public MappedObject16 map(ResultSet rs) throws Exception {
MappedObject16 o = new MappedObject16();
o.setId(rs.getLong(1));
o.setName(rs.getString(2));
o.setEmail(rs.getString(3));
o.setYearStarted(rs.getInt(4));
o.setField5(rs.getShort(5));
o.setField6(rs.getInt(6));
o.setField7(rs.getLong(7));
o.setField8(rs.getFloat(8));
o.setField9(rs.getDouble(9));
o.setField10(rs.getShort(10));
o.setField11(rs.getInt(11));
o.setField12(rs.getLong(12));
o.setField13(rs.getFloat(13));
o.setField14(rs.getDouble(14));
o.setField14(rs.getDouble(14));
o.setField15(rs.getInt(15));
o.setField16(rs.getInt(16));
return o;
}
};
}
Aggregations