Final String _sql = "Select U.name as Name, U.age, U.type, U.birth from Ym_user u WHERE u.age >?, U.type =?"; /1. Encapsulates the result set of the SQL query as an array list<object[]> _results = jdbc.opensession (New isessionexecutor<list<object[]> > () {public list<object[]> execute (isession session) throws Operatorexception {return Session.findall (_sql, New Arrayresultsethandler (), new object[] {(), "M"});}); /2. The result set of the SQL query is encapsulated in the form of Map list<map<string, object>> _results = jdbc.opensession (New isessionexecutor<list <map<string, object>>> () {public list<map<string, object>> execute (isession session) Throws Operatorexception {return Session.findall (_sql, New Mapresultsethandler (), new object[] {, "M"});}); The result set traversal methods of/1 and 2 are as follows Resultsethelper _help = Resultsethelper.bind (_results); for (int _idx = 0; _idx < _help.getrowcount (); _i dx++) {System.out.println (_help.getasstring ("name")); System.out.println (_help.getasinteger (2));} 3. Custom result set logging process List<customuser> _results = jdbc.opensession (new isessionexecutor<list<customuser>> () {public List< Customuser> Execute (isession session) throws Operatorexception {return Session.findall (_sql, new Abstractresultsethandler<customuser> () {public void Processrowdata (ResultSet rs, list<customuser> result ) throws Operatorexception, SQLException {customuser _u = new Customuser (); _u.setusername (rs.getstring ("name"));// ... result.add (_u);}, New object[]{18, "M"});});
About YMP Framework JDBC Query result set Custom processing method