java - JDBI ResultSetMapper: partially map row to a Class -
java - JDBI ResultSetMapper: partially map row to a Class -
when define mapper class, have fetch every column in sql queries in order map class in jdbc resultsetmapper
eg.
public class mapper implements resultsetmapper<myclass>{ public myclass map(int index, resultset rs, statementcontext ctx) throws sqlexception{ myclass mc = new myclass(); mc.setentity1(rs.getstring("column1")); mc.setentity2(rs.getstring("column2")); mc.setentity3(rs.getstring("column3")); homecoming mc; } }
for using mapper, have fetch every column used in mapper, if fetch 2 columns throw psqlexception.
so instead of defining mapper fetching 2 columns, there possible method utilize same mapper mapping myclass?
java jdbc resultset jdbi sqlresultsetmapping
Comments
Post a Comment