mardi 10 mars 2015

Mybatis: Invoking a stored proc that returns a cursor of a custom type


Vote count:

0




I'm looking to write MyBatis Java code to invoke an Oracle stored proc defined as follows:



TYPE MyCustomTyp IS RECORD
(
// Columns defined here
);

TYPE MyCustomCurTyp IS REF CURSOR
RETURN MyCustomTyp;


PROCEDURE my_stored_proc_a_b_c (
p_request_1 IN VARCHAR,
p_rset OUT my_pkg_a_b_c.MyCustomCurTyp);


My interpretation of this is that we are returning a CURSOR that contains a single STRUCT


However, I am unsure how to write this using MyBatis


I know that I need to write a typeHandler to map to my Java object but do I need to define a resultMap?


I've attempted a select like this but it complains of the jdbcTypeName:



<select parameterType="java.util.Map" statementType="CALLABLE">
{CALL
my_pkg_a_b_c.my_stored_proc_a_b_c(#{myResults, mode=OUT, jdbcType=STRUCT, jdbcTypeName=my_pkg_a_b_c.IVRecTyp, typeHandler=com.MyCustomTypeHandler},
#{input, mode=IN}
)}
</select>


What is the general approach to take here?



asked 1 min ago

DJ180

1,502






Mybatis: Invoking a stored proc that returns a cursor of a custom type

Aucun commentaire:

Enregistrer un commentaire