Cursor Types in Procedures
This tutorial will discuss cursor types in procedures in the spring framework using Spring DAO/JDBC. If we want to use CURSOR types in Stored Procedures to retrieve multiple Records data, then we have to use the following method on SimpleJdbcCall reference.
// SimpleJdbcCall reference.
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(dataSource);
jdbcCall = jdbcCall.withProcedureName("getAllEmployees");
jdbcCall = jdbcCall.returningResultSet("emps",BeanPropertyRowMapper.newInstance(Employee.class));
After adding the returningResultSet(–,–) method, if we access execute() method on SimpleJdbcCall then execute() method will execute. The procedure will get all the results from the CURSOR type variable and store all records in the form of Employee objects in an ArrayList object with “emps”[CURSOR TYPE variable] key in a Map.
Cursor Types in Procedures