ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hill_...@hsbc.ca
Subject How to get both of return value and return result
Date Tue, 28 Aug 2007 20:43:49 GMT

I am very sorry to repost this, because my original thread was occupied. 
Here is my problem:

I have a DB2 stored procedure returns a single value and a result set at 
the same time, like this: 

                Select * FROM USERS WHERE UserID = pUserID; 

        OPEN DB2_SP_SQL1; 
        RETURN 100; 

I tried many times, I can only get the return value (100) back, while the 
return result set is always empty. Here is the iBatis configuration and 
java code: 

1. iBatis Configuration: 

        <parameterMap id="parameter" class="java.util.HashMap" > 
                <parameter property="pReturnCode" jdbcType="INTEGER" 
javaType="java.lang.Integer" mode="OUT"/>         
                <parameter property="pUSERID" jdbcType="INTEGER" javaType=
"java.lang.Integer" mode="IN"/> 

        <procedure id="getUserProfile" parameterMap="parameter" resultMap=
                {? = call TEST_GETUSERSBYID (?)} 

2. Java Code: 

        HashMap parameters = new HashMap(); 
        Integer returnCode = new Integer(-1); 
        parameters.put("ReturnCode", returnCode); 
        parameters.put("UserID", new Integer(userID));                 

        UserProfile userProfile = 

3. Result:  userProfile is null, the ReturnCode in the HashMap is 100. 
After I debugged into the iBatis code, I found the code does populate some 
data (I am not sure what data it is) into the resultset object. But 
rs.next()returns false, so the code ignores the resultset and doesn't do 
any mapping for the result set. 

Is it unsupported by iBatis? 

Hill Xie

This email may contain confidential information, and is intended only for the named recipient
and may be privileged. Distribution or copying of this email by anyone other than the named
recipient is prohibited. If you are not the named recipient, please notify us immediately
and permanently destroy this email and all copies of it. Internet email is not private, secure,
or reliable.  No member of the HSBC Group is liable for any errors or omissions in the content
or transmission of this email. Any opinions contained in this email are solely those of the
author and, unless clearly indicated otherwise in writing, are not endorsed by any member
of the HSBC Group.
Ce courriel peut renfermer des renseignements confidentiels et privilégiés et s'adresse au
destinataire désigné seulement.   La distribution ou la copie de ce courriel par toute personne
autre que le destinataire désigné est interdite.  Si vous n'êtes pas le destinataire désigné,
veuillez nous en aviser immédiatement et détruire de façon permanente ce courriel ainsi que
toute copie de celui-ci. La transmission de courriel par Internet ne constitue pas un mode
de transmission confidentiel, sécuritaire ou fiable. Aucun membre du Groupe HSBC ne sera responsable
des erreurs ou des omissions relatives au contenu ou à la transmission de ce courriel.  L'auteur
de ce courriel est seul responsable des opinions émises dans ce courriel, lesquelles, à moins
 d'un avis contraire fourni par écrit, ne sont pas endossées par aucun membre du Groupe HSBC.



View raw message