ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fábio Pisaruk" <pisa...@gmail.com>
Subject Re: Get return value and return result set
Date Mon, 27 Aug 2007 20:15:18 GMT
Hi guys!

I´m trying to use ibatis to generate xml from my tables but i can´t find any
useful examples to do so.
I have the following problem: Suppose there are two tables named Person,
Phones. I´d like to generate a xml document like this:

<Person>
  <PersonID>9999<PersonID>
  <Name>Name of person</Name>
  <Phones>
    <Phone>5555-5555</Phone>
    <Phone>1111-5555</Phone>
    <Phone>2222-5555</Phone>
  <Phones>
</Person>

Here are my maps:

<resultMap id="person-ResultMap" class="xml" groupBy="personID">
  <result property="name" column="name"/>
  <result property="personID" column="personID"/>
  <result property="phones" resultMap="phone-ResultMap"/>
<resultMap/>

<resultMap id="phone-ResultMap" class="xml">
  <result property="name" column="name"/>
  <result property="personID" column="personID"/>
<resultMap/>

<select id="getPerson" parameterClass="int" resultMap="person-ResultMap">
        select name,number,personID
        from Person,Phone
        where personID= ?
</select>

But i can´t make it to work.
I think that ibatis doesn´t support nested lists :-(

Thanks in advance.







On 8/27/07, Hill_XIE@hsbc.ca <Hill_XIE@hsbc.ca> wrote:
>
>
> Hi Brandon,
>
> Thank you for your reply. I did try it with the straight JDBC, and it
> works. In straight JDBC the return value of the stored procedure is the
> first output parameter of the callable statement.
> ------------------------------------------------------
> Hill Xie
>
>
>
>  *"Brandon Goodin" <brandon.goodin@gmail.com>*
>
> 27/08/2007 03:45 PM  Please respond to
> user-java@ibatis.apache.org
>
>   To
> user-java@ibatis.apache.org  cc
>
>  Subject
> Re: Get return value and return result set
>
>
>
>
>
>
> iBATIS uses standard JDBC support for multiple result sets. Have you tried
> implementing this in straight JDBC using your driver to see if it is
> supported by the driver?
>
> Thanks,
> Brandon
>
> On 8/27/07, *Hill_XIE@hsbc.ca* <Hill_XIE@hsbc.ca> <*Hill_XIE@hsbc.ca*<Hill_XIE@hsbc.ca>>
> wrote:
>
> 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Ã(c)giÃ(c)s et s'adresse au destinataire dÃ(c)signÃ(c) seulement. La
> distribution ou la copie de ce courriel par toute personne autre que le
> destinataire dÃ(c)signÃ(c) est interdite. Si vous n'êtes pas le destinataire
> dÃ(c)signÃ(c), veuillez nous en aviser immÃ(c)diatement et dÃ(c)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Ã(c)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 Ã(c)mises
> dans ce courriel, lesquelles, Ã  moins d'un avis contraire fourni par
> Ã(c)crit, ne sont pas endossÃ(c)es par aucun membre du Groupe HSBC.
> ***************************************************************
>
> "SAVE PAPER - THINK BEFORE YOU PRINT!"
>
> "ÉCONOMISEZ LE PAPIER â€" PENSEZ-Y À DEUX FOIS AVANT D'IMPRIMER!"
>
>
> ***************************************************************
> 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!"
>



-- 
Visto como se não executa logo a sentença sobre a má obra, o coração dos
filhos dos homens está inteiramente disposto a praticar o mal.


--Nerd´s sign

If you have four classes, Everybody, Somebody, Anybody, and Nobody, if
Somebody has a bug, it could be Anybody 's fault but Nobody really knows,
while Everybody shares responsibility.
Mime
View raw message