Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 27506 invoked from network); 27 Aug 2007 17:32:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Aug 2007 17:32:52 -0000 Received: (qmail 82430 invoked by uid 500); 27 Aug 2007 17:32:45 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 82414 invoked by uid 500); 27 Aug 2007 17:32:45 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 82400 invoked by uid 99); 27 Aug 2007 17:32:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 10:32:45 -0700 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.129.90.200] (HELO arrows.electric.net) (216.129.90.200) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 17:32:40 +0000 Received: from root by arrows.electric.net with emc1-ok (Exim 4.67) (envelope-from ) id 1IPiRj-0003dt-VY for user-java@ibatis.apache.org; Mon, 27 Aug 2007 10:32:16 -0700 Received: by emcmailer; Mon, 27 Aug 2007 10:32:15 -0700 Received: from [204.50.7.202] (helo=) by arrows.electric.net with esmtps (SSLv3:RC4-MD5:128) (Exim 4.67) (envelope-from ) id 1IPiRU-0003TY-UA for user-java@ibatis.apache.org; Mon, 27 Aug 2007 10:32:00 -0700 In-Reply-To: To: user-java@ibatis.apache.org Subject: Get return value and return result set MIME-Version: 1.0 X-Mailer: Lotus Notes Release 7.0.2 September 26, 2006 Message-ID: From: Hill_XIE@hsbc.ca Date: Mon, 27 Aug 2007 13:31:58 -0400 X-MIMETrack: Serialize by Router on MAIL02/HKBC(Release 7.0.1 HF183|May 12, 2006) at 08/27/2007 10:32:00 AM, Serialize complete at 08/27/2007 10:32:00 AM Content-Type: multipart/alternative; boundary="=_alternative 00604F3C85257344_=" X-Outbound-IP: 204.50.7.202 X-Env-From: Hill_XIE@hsbc.ca X-Virus-Status: Scanned by VirusSMART (s) X-Virus-Status: Scanned by VirusSMART (c) X-Disclaimer-Added: DONE X-Virus-Checked: Checked by ClamAV on apache.org This is a multipart message in MIME format. --=_alternative 00604F3C85257344_= Content-Type: text/plain; charset="US-ASCII" Hi, I have a DB2 stored procedure returns a single value and a result set at the same time, like this: DECLARE DB2_SP_SQL1 CURSOR WITH RETURN FOR 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: {? = 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 = (UserProfile)getSqlMapClientTemplate().queryForObject("getUserProfile", parameters); 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 sure what data) 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? Thanks, ------------------------------------------------------ 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. *************************************************************** "SAVE PAPER - THINK BEFORE YOU PRINT!" "�CONOMISEZ LE PAPIER � PENSEZ-Y � DEUX FOIS AVANT D'IMPRIMER!" --=_alternative 00604F3C85257344_= Content-Type: text/html; charset="US-ASCII"
Hi,

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

        DECLARE DB2_SP_SQL1 CURSOR WITH RETURN FOR
                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"/>
        </parameterMap>

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

2. Java Code:

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

        UserProfile userProfile = (UserProfile)getSqlMapClientTemplate().queryForObject("getUserProfile", parameters);

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 sure what data) 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?

Thanks,
------------------------------------------------------
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.
***************************************************************

"SAVE PAPER - THINK BEFORE YOU PRINT!"

"�CONOMISEZ LE PAPIER � PENSEZ-Y � DEUX FOIS AVANT D'IMPRIMER!"
--=_alternative 00604F3C85257344_=--