Mapping both Result Set & OUT Parameter from Sql SP in IBATIs

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mapping both Result Set & OUT Parameter from Sql SP in IBATIs

ArunMP
Hi,
My SP will return both OUT variable and a Result Set.
How can i access these values simultaneously.??
Here is my Parameter map, result map and SP call..

<parameterMap id="customerSearch" class="map" >
        <parameter property="result" jdbcType="Int"
                        javaType="java.lang.Integer" mode="OUT" />
        <parameter property="lastName" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        <parameter property="phNbrCode" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        <parameter property="phNbr" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        <parameter property="addr" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        <parameter property="city" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        <parameter property="state" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        <parameter property="zip" jdbcType="varchar"
                        javaType="java.lang.String" mode="IN" />
        </parameterMap>


        <resultMap id="customerSearchResult" class="customer">
                <result property="rowNbr" column="tempId" />
                <result property="customerId" column="ctctId" />
                <result property="customerName" column="CustomerName" />
                <result property="businessName" column="BusinessName" />
                <result property="address" column="strAddress"/>
                <result property="phoneNumber" column="PhoneNbr" />
                <result property="count" column="resultCount" />
        </resultMap>


procedure id="getCustomerSearchResult" parameterMap="customerSearch"
                resultMap="customerSearchResult">
                {call pr_getCustomerSearchResult(?,?,?,?,?,?,?,?) }
                </procedure>

Here is my java part..
List customerSearchResult = null;
                Map sample=this.setCustomerSearch(customerSearchCriteria);
                try {
                       
                        customerSearchResult= this.getSqlMapClientTemplate().queryForList(
                                        "FulfillmentSQL.getCustomerSearchResult",sample);
                       
                        Integer x = (Integer)sample.get("result");
                       
                        System.out.println("\n\ncouint-->"+x);
                        } catch (Exception e) {
                                this.logger.logError("FulfillmentDaoiBatis:getCustomerSearchResult()", e);
                }

pls help me..


Thanks
Arun