I can't do any more without some working code. If you'd like further
suggestions, then please package up a working sample. Include the
necessary DDL to create the tables and stored procedures, and insert
some dummy data into the tables. You can attach a zip file in email
sent to this mailing list.
On 3/2/2014 6:17 AM, Parag Dhikale wrote:
> More update on this, Just to confirm whether my multiple resultset
> return works correctly, I converted 'dpt' association object relation in
> 'Contact' to 'list' type, i.e. collection. and used following syntax,
> which worked perfectly:
>
> *MAPPER:
>
> * <resultMap id="contactResult" type="Contact">
> <id property="id" column="CONTACT_ID"/>
> <result property="deptId" column="C_DEPT_ID"/>
> <result property="name" column="CONTACT_NAME"/>
> <result property="phone" column="CONTACT_PHONE"/>
> <*collection property="dpt" select="getDpt"
> column="C_DEPT_ID" resultSet="dept" foreignColumn="DEPT_ID"
> ofType="Dept" javaType="java.util.ArrayList"/*>
> <collection property="emailList" resultSet="emails"
> select="getEmailList"
> column="CONTACT_ID" foreignColumn="E_CONTACT_ID"
> ofType="Email" javaType="java.util.ArrayList" >
> </collection>
> </resultMap>
>
> *Query:
> * <select id="findAllContacts4" resultSets="emails, dept"
> parameterType="Contact" statementType="CALLABLE" resultMap="contactResult">
> {call get_all_contacts3(#{id, mode=INOUT, jdbcType=INTEGER},
> #{deptId, mode=INOUT, jdbcType=INTEGER}, #{name, mode=OUT,
> jdbcType=VARCHAR},
> #{phone, jdbcType=VARCHAR, mode=OUT},
> #{emailList, jdbcType=CURSOR,
> javaType=java.sql.ResultSet,resultMap=com.sigma.samp.stmSample.EmailInterFace.emailResult,
> mode=OUT},
> #{dpt, *jdbcType=CURSOR, javaType=java.sql.ResultSet*,
> resultMap=com.sigma.samp.stmSample.DeptInterFace.deptResult, mode=OUT})}
> </select>
>
> *Procedure:
> *
> CREATE OR REPLACE PROCEDURE get_all_contacts3 (V_CONTACT_ID IN OUT
> NUMBER, V_DEPT_ID IN OUT NUMBER, V_CONTACT_NAME OUT VARCHAR2,
> V_CONTACT_PHONE OUT
> VARCHAR2, EMAIL_LIST out sys_refcursor,
> V_DEPT OUT *sys_refcursor*)
> IS
> BEGIN
>
> SELECT CONTACT_ID, CONTACT_NAME, CONTACT_PHONE
> INTO V_CONTACT_ID, V_CONTACT_NAME, V_CONTACT_PHONE
> FROM CONTACT
> WHERE CONTACT_ID = V_CONTACT_ID;
>
> OPEN EMAIL_LIST FOR
> SELECT *
> from EMAIL
> WHERE E_CONTACT_ID = V_CONTACT_ID;
>
> -- SELECT * into V_DEPT
> -- FROM DEPT
> -- WHERE DEPT_ID = V_DEPT_ID;
>
> OPEN *V_DEPT *FOR
> SELECT *
> FROM DEPT
> WHERE DEPT_ID = V_DEPT_ID;
>
>
> END;
> /
>
> ================================================================================
>
> But I don't want to change my association type to collection just for this.
>
> I want this to work with :
>
> *Mapper:
>
> * <resultMap id="contactResult" type="Contact">
> <id property="id" column="CONTACT_ID"/>
> <result property="deptId" column="C_DEPT_ID"/>
> <result property="name" column="CONTACT_NAME"/>
> <result property="phone" column="CONTACT_PHONE"/>
> * <association property="dpt" select="getDpt"
> column="C_DEPT_ID" resultSet="dept" foreignColumn="DEPT_ID"
> javaType="Dept" />*
> <collection property="emailList" resultSet="emails"
> select="getEmailList"
> column="CONTACT_ID" foreignColumn="E_CONTACT_ID"
> ofType="Email" javaType="java.util.ArrayList" >
> </collection>
> </resultMap>*
>
> Procedure:
>
> *CREATE OR REPLACE PROCEDURE get_all_contacts3 (V_CONTACT_ID IN OUT
> NUMBER, V_DEPT_ID IN OUT NUMBER, V_CONTACT_NAME OUT VARCHAR2,
> V_CONTACT_PHONE OUT
> VARCHAR2, EMAIL_LIST out sys_refcursor,
> V_DEPT OUT *DEPT%rowtype*)
> IS
> BEGIN
>
> SELECT CONTACT_ID, CONTACT_NAME, CONTACT_PHONE
> INTO V_CONTACT_ID, V_CONTACT_NAME, V_CONTACT_PHONE
> FROM CONTACT
> WHERE CONTACT_ID = V_CONTACT_ID;
>
> OPEN EMAIL_LIST FOR
> SELECT *
> from EMAIL
> WHERE E_CONTACT_ID = V_CONTACT_ID;
>
> SELECT * into *V_DEPT*
> FROM DEPT
> WHERE DEPT_ID = V_DEPT_ID;
>
>
> END;
> /*
>
> Query:
>
> * <select id="findAllContacts4" resultSets="emails, dept"
> parameterType="Contact" statementType="CALLABLE" resultMap="contactResult">
> {call get_all_contacts3(#{id, mode=INOUT, jdbcType=INTEGER},
> #{deptId, mode=INOUT, jdbcType=INTEGER}, #{name, mode=OUT,
> jdbcType=VARCHAR},
> #{phone, jdbcType=VARCHAR, mode=OUT},
> #{emailList, jdbcType=CURSOR,
> javaType=java.sql.ResultSet,resultMap=com.sigma.samp.stmSample.EmailInterFace.emailResult,
> mode=OUT},
> #{dpt, jdbcType=*<?>*,
> javaType*=com.sigma.samp.stmSample.Dept*,
> resultMap=com.sigma.samp.stmSample.DeptInterFace.deptResult, mode=OUT})}
> </select>*
> #{dpt, jdbcType=*ROWTYPE*, javaType=Dept,
> --
> You received this message because you are subscribed to the Google
> Groups "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
mybatis-user...@googlegroups.com
> <mailto:
mybatis-user...@googlegroups.com>.
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com