ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjpn <p...@vignette.com>
Subject Re: stored procedure -> resultClass example?
Date Wed, 22 Apr 2009 15:12:00 GMT

thanks. I looked at that and i think my parameter jdbcTyes and javaTypes are
ok. here's my sql map

<sqlMap>

    <resultMap id="reg-folder-result" class="com.mystuff.favorites.Folder">
        <result property="id" column="FOLDER_ID"/>
        <result property="name" column="FOLDER_NAME"/>
        <result property="personNumber" column="PERSON_NUMBER"/>
        <result property="unfiled" column="UNFILED"/>
    </resultMap>
    <parameterMap id="get-reg-folder-params" class="java.util.Map">
        <parameter property="personNumber" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>
        <parameter property="rsFolder" jdbcType="ORACLECURSOR" mode="OUT"
resultMap="reg-folder-result"/>
    </parameterMap>
    <procedure id="spGetRegFolderByUser"
parameterMap="get-reg-folder-params" resultMap="reg-folder-result">
        { call FAVORITES.GET_RGLR_FOLDERS( ?,? ) }
    </procedure>

</sqlMap>


and my stored proc package and body


create or replace
PACKAGE FAVORITES AS
TYPE REF_CURSOR IS REF CURSOR RETURN FAVORITES_FOLDERS%ROWTYPE;

PROCEDURE GET_RGLR_FOLDERS(P_PERSON_NUMBER IN
FAVORITES_FOLDERS.PERSON_NUMBER%TYPE,P_CURSOR OUT SYS_REFCURSOR);

END FAVORITES;


create or replace
PACKAGE BODY        "FAVORITES" AS

  PROCEDURE GET_RGLR_FOLDERS(
    P_PERSON_NUMBER IN FAVORITES_FOLDERS.PERSON_NUMBER%TYPE,
    P_CURSOR OUT SYS_REFCURSOR
  ) AS
  BEGIN
    OPEN P_CURSOR FOR 
    SELECT FOLDER_ID, FOLDER_NAME, PERSON_NUMBER, UNFILED
    FROM FAVORITES_FOLDERS
    WHERE PERSON_NUMBER = P_PERSON_NUMBER
    AND UNFILED = 'N';
  END GET_RGLR_FOLDERS;

END FAVORITES;



-- 
View this message in context: http://www.nabble.com/stored-procedure--%3E-resultClass-example--tp23148960p23175516.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message