mercredi 15 avril 2015

mybatis spring ref cursor mapping

I am using mybatis-spring and trying to map a ref cursor from oracle. The result is coming back as null. Any ideas please?



<select id="check" parameterType="myVO"
resultMap="VOResultMap" statementType="CALLABLE" resultType="object">
{ call MYPKG.proc_check(
#{myVO.id, javaType=String, jdbcType=VARCHAR,mode=IN},
#{myVO, mode=OUT, javaType=ResultSet, jdbcType=CURSOR, resultMap=VOResultMap}
)}


SP:



PROCEDURE proc_check (
p_id IN VARCHAR2, po_outCursor OUT SYS_REFCURSOR)
IS
BEGIN
OPEN po_outCursor FOR
SELECT * FROM MYTABLE;
END;


Map:



<resultMap id="VOResultMap" type="myVO">
<result property="action" column="ACTION" />
<result property="id" column="ID" />
<result property="name" column="NAME" />
</resultMap>


DAO:



public MyVO check(@Param("VO") MyVO myVO);


Usage:



MyVO myVO = new MyVO(id);
MyVO obj = myDAO.check(myVO);
// obj is null !!


Many thanks,


Aucun commentaire:

Enregistrer un commentaire