I'm calling a stored proc using CallableStatement as below:
Connection connection = jdbcTemplate.getDataSource().getConnection();
CallableStatement callSt = connection.prepareCall("{call my_proc(?, ?)}");
callSt.setDate(1, getDate());
callSt.registerOutParameter(2, oracle.jdbc.OracleTypes.CURSOR);
callSt.execute();
ResultSet rs = (ResultSet) callSt.getObject(2);
I then iterate the result set to create a List<MyPojo>
having 4 5 items
My query is how do I avoid iterating ResultSet and use RowMapper to get List
PS: I found the other way of using mapper using SimpleJdbcCall
SimpleJdbcCall call = new SimpleJdbcCall(jdbcTemplate)
.withSchemaName("myindex")
.withCatalogName("mypackage")
.withProcedureName("my_proc")
.declareParameters(new SqlParameter[]{
new SqlParameter("myinput", OracleTypes.DATE),
new SqlOutParameter("myoutput", OracleTypes.CURSOR, new MyMapper())
});