If you encounter such a problem, you need to call a stored procedure that returns two cursors through ibatis. I found many questions on the Internet, but it was difficult to find a solution. So I estimated that the method of processing the stored procedure that returned a cursor was called, the stored procedure that calls two returned cursors. Share it with you.
Example:
Stored Procedure:
Create or replace function fn_tester (cursor_data1 out sys_refcursor, cursor_data2
Out sys_refcursor) return numberas
Begin begin open cursor_data1
For select e. data_1, E. data_2, E. data_3 from a_table
E; open cursor_data2
For for select e. data_4, E. data_5, E. data_6 from B _table
E; end fn_tester;
Sqlmap statement: <! -- Cursor 1 Data configuration --> <resultmap class = "com. Table1" id = "result1">
<Result property = "data1" column = "data_1"/>
<Result property = "data2" column = "data_2"/>
<Result property = "data3" column = "data_3"/>
</Resultmap>
<! -- Cursor 2 Data configuration -->
<Resultmap class = "com. Table2" id = "result2">
<Result property = "data4" column = "data_4"/>
<Result property = "data5" column = "data_5"/>
<Result property = "data6" column = "data_6"/>
</Resultmap>
<! -- Call the input parameter configuration of the stored procedure -->
<Parametermap class = "Java. util. hashmap" id = "testparam">
<Parameter property = "result" jdbctype = "integer"
Javatype = "Java. Lang. Long" mode = "out"/>
<Parameter property = "table1data" jdbctype = "oraclecursor"
Javatype = "Java. SQL. resultset" resultmap = "result1" mode = "out"/>
<Parameter property = "table2data" jdbctype = "oraclecursor"
Javatype = "Java. SQL. resultset" resultmap = "result2" mode = "out"/>
</Parametermap>
<! -- Start the stored procedure -->
<Procedure id = "testid" parametermap = "testparam">
<! [CDATA [
{? = Call fn_tester (?,?)}
]>
</Procedure>
Data acquisition at the DaO layer: Table1 and Table2 are two pojo;
Public VoidGetdata (MapParammap)Throws Sqlexception{Try{Getsqlmapclienttemplate (). queryforobject (Namespace+ "Testid", parammap); // cursor 1 gets the list <Table1> Datalist1 =(List <Table1>) parammap. Get ( "Table1data" ); // Cursor 2 get list <Table 2> Datalist2 =(List <Table2>) parammap. Get ( "Table2data" );}Catch(SqlexceptionE)
{ThrowE;} system.Out. Println (Datalist1); System.Out. Println (Datalist2);}
Write a test case and you can test it.