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 Wed, 29 Aug 2007 17:21:01 GMT
That´s is exatcly what i´m doing. Ops, kind of because i´m using
java.util.Arrays and the method toArray() but if ibatis could return array i
would have to write much less code hence i would have a more elegant code.



On 8/28/07, ayan.m.afridi@jpmchase.com <ayan.m.afridi@jpmchase.com> wrote:
>
>
> I am sorry, I reread your question, and you are having an issue because
> Ibatis returns collections.
>
> Either way, What I am saying is why dont you use ibatis to retrieve the
> collections, and then iterate through the collection and create an Object
>  Array?  I know thats  abit annoying and from a processing standpoint might
> be unreasonable if you have huge amounts of data.
>
>
> -Ayan
>
>
>
>
>
>  *"Fábio Pisaruk" <pisaruk@gmail.com>*
>
> 08/28/2007 05:47 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
>
>
>
>
>
>
> I will give it a try again despite been unsuccessful in past.
> Maybe version 2.2 didn´t support this feature(return arrays) yet.
> Tks.
>
> On 8/28/07, *ayan.m.afridi@jpmchase.com* <ayan.m.afridi@jpmchase.com> <*
> ayan.m.afridi@jpmchase.com* <ayan.m.afridi@jpmchase.com>> wrote:
>
> Maybe I am missing something, but coudln't you read in the Object[] arrays
> through ibatis, and then in your own methods, convert them to Lists? That
> way your other xml library can properly read them?
>
> Ayan
>
>
>   *"Fábio Pisaruk" <**pisaruk@gmail.com* <pisaruk@gmail.com>*>*
>
> 08/28/2007 05:12 PM
>   Please respond to*
> **user-java@ibatis.apache..org* <user-java@ibatis.apache.org>
>
>
>   To
> *user-java@ibatis.apache.org* <user-java@ibatis.apache.org>, *
> lmeadors@apache.org* <lmeadors@apache.org>  cc
>
>  Subject
> Re: Get return value and return result set
>
>
>
>
>
>
>
>
> Thanks for your support.
> I´m giving up ibatis xml built support.
> It´s a pitty because i thought it´d help me a lot and maker map much
> simpler...
>
> .....
>
>
> On 8/28/07, *Larry Meadors* <*lmeadors@apache.org * <lmeadors@apache.org>>
> wrote:
> OK, the built in xml support in iBATIS is .. well, lame. Don't use it.
> It will not be a core part of iBATIS3.
>
> Now, are you talking about this? -> *http://xmlbeans.apache.org/ *<http://xmlbeans.apache.org/>
>
> If you are, that is not what iBATIS is going to spit out for you. I'd
> suggest that if you need xml formatted the way that they do it, you'll
> need to code that up yourself - iBATIS is not going to do that for
> you. Odds are good that XStream will get you close.
>
> Larry
>
>
> On 8/28/07, Fábio Pisaruk <*pisaruk@gmail.com* <pisaruk@gmail.com> >
> wrote:
> > Okay Niels.
> > Thank you.
> > I can´t figure out how xstream can be of any help to me.
> > Let me state my problem:
> > I´ve got to build a xml from a set of data storage in a RDMS and to do
> so
> > i´m using ibatis to map data to xmlbean objects. The main issue is that
> > xmlbean maps nested list to java array( e.g Object[]) but ibatis works
> only
> > with Collections.
> > My idea was to use ibatis xml generation approach to avoid filling
> xmlbeans
> > objects due to this incompatibility.
> >
> >
> >
> >
> >
> > On 8/28/07, Niels Beekman <*n.beekman@wis.nl* <n.beekman@wis.nl> >
> wrote:
> > >
> > >
> > >
> > >
> > > I don't have any experience with returning XML from iBATIS, you'd
> probably
> > be better off using  XStream, like Clinton suggested, it's specifically
> > written for dealing with XML. And if I'm not mistaken, the next version
> of
> > iBATIS will remove XML-generation altogether, somebody correct me if I'm
>
> > wrong.
> > >
> > >
> > >
> > > Niels
> > >
> > >
> > >
> > > ________________________________
> >
> > >
> > > From: Fábio Pisaruk [mailto: *pisaruk@gmail.com* <pisaruk@gmail.com>
]
> > > Sent: dinsdag 28 augustus 2007 18:55
> > >
> > > To: *user-java@ibatis.apache.org* <user-java@ibatis.apache.org>
> > > Subject: Re: Get return value and return result set
> > >
> > >
> > >
> > >
> > > Hello Niels!
> > >
> > > I´ve already tried that before posting but it didn´t work either.
> > > I´ve seen that i should use xmlCollection type to do what i want. Is
> it
> > rigth?
> > > There´s no documentation related to retrieve nested xml elements so
> i´ll
> > take a look at the source code and see what i can see.
> > >
> > > Thanks.
> > >
> > >
> > > On 8/28/07, Niels Beekman < *n.beekman@wis.nl* <n.beekman@wis.nl>
>
> wrote:
> > >
> > >
> > >
> > > Change <select id="nsGuiaConsulta.getCID" resultMap="get-cids"
> > parameterClass="int"> to <select id=" getCID" resultMap="get-cids"
> > parameterClass="int">, the configured namespace includes all statements
> in
> > the same SQLMap.
> > >
> > >
> > >
> > > Niels
> > >
> > >
> > >
> > > ________________________________
> >
> > >
> > > From: Fábio Pisaruk [mailto: *pisaruk@gmail.com* <pisaruk@gmail.com>
]
> > > Sent: maandag 27 augustus 2007 23:45
> > > To: *user-java@ibatis.apache.org* <user-java@ibatis.apache.org>
> > > Subject: Re: Get return value and return result set
> > >
> > >
> > >
> > >
> > > First of all i´s like to thank for the immediate response.
> > > Second, i wanna apologize for posting a new question in an already
> oppened
> > thread. My bad.
> > > Third, As far as i´m concerned you have just pointed out the missing
> > namespace at my code.
> > > I´ve added it but it didn´t work. I am still having the same error.
> > > Here is my real code:
> > >
> > > <sqlMap namespace="nsGuiaConsulta">
> > > <resultMap class="xml" id="get-guias" xmlName="guiaConsulta">
> > >         <result property="beneficiario" resultMap="get-beneficiario"
> > javaType="ctBeneficiario"/>
> > >         <result property="cid" javaType="xmlCollection"
> column="num_lote"
> > select=" nsGuiaConsulta.getCID"/>
> > >     </resultMap>
> > >
> > >     <resultMap class="xml" id="get-beneficiario"
> xmlName="beneficiario">
> > >         <result property="numeroCarteira"
> > column="numeroCarteiraBeneficiario"/>
> > >         <result property="nomeBeneficiario"
> column="nomeBeneficiario"/>
> > >         <result property="nomePlano" column="nomePlano"/>
> > >         <result property="validadeCarteira"
> > column="validadeCarteiraBeneficiario"/>
> > >         <result property="numeroCNS"
> > column="numeroCNSBeneficiario"/>
> > >     </resultMap>
> > >
> > >     <resultMap class="xml" id="get-header"
> xmlName="identificacaoGuia">
> > >         <result property="dataEmissaoGuia" column="dataEmissaoGuia"/>
> > >         <result property="numeroGuiaPrestador"
> > column="numeroGuiaPrestador"/>
> > >         <result property="numeroGuiaOperadora"
> > column="numeroGuiaOperadora"/>
> > >         <result property="registroANS" column="registroANS"/>
> > >     </resultMap>
> > >
> > >     <resultMap class="xml" id="get-cids">
> > >         <result property="cid" column="seq_conta"/>
> > >     </resultMap>
> > >
> > >     <select id="getLoteGuias" parameterClass="int"
> resultMap="get-guias">
> > >         <include refid="campos-guia-tiss"/>
> > >         where             c.seq_lote = #seq_lote#
> > >     </select>
> > >
> > >
> > >     <select id=" nsGuiaConsulta.getCID" resultMap="get-cids"
> > parameterClass="int">
> > >         select seq_conta
> > >         from   tiss_conta
> > >         where  seq_lote = 943344
> > >     </select>
> > > </sqlMap>
> > >
> > > Forget about campos-guia-tiss. Consider that it return all required
> > fields.
> > >
> > > The error i´m receiving is:
> > >
> > > org.springframework.jdbc.UncategorizedSQLException :
> > SqlMapClient operation; uncategorized SQLException for SQL []; SQL state
> > [null]; error code [0];
> > > --- The error occurred in
> > br/com/crc/tiss/arquivo/data/ibatis/sqlMaps/GuiaDeConsulta.xml.
> >
> > > --- The error occurred while applying a result map.
> > > --- Check the nsGuiaConsulta.get-guias.
> > > --- Check the result mapping for the 'cid' property.
> > > --- Cause: com.ibatis.sqlmap.client.SqlMapException:
> > There is no statement named nsGuiaConsulta.getCID in this SqlMap.;
> nested
> > exception is
> > com.ibatis.common.jdbc.exception.NestedSQLException :
> > > --- The error occurred in
> > br/com/crc/tiss/arquivo/data/ibatis/sqlMaps/GuiaDeConsulta.xml.
> >
> > > --- The error occurred while applying a result map.
> > > --- Check the nsGuiaConsulta.get-guias .
> > > --- Check the result mapping for the 'cid' property.
> > > --- Cause: com.ibatis.sqlmap.client.SqlMapException:
> > There is no statement named nsGuiaConsulta.getCID in this SqlMap.
> > > Caused by:
> > com.ibatis.common.jdbc.exception.NestedSQLException:
> > > --- The error occurred in
> > br/com/crc/tiss/arquivo/data/ibatis/sqlMaps/GuiaDeConsulta.xml.
> >
> > > --- The error occurred while applying a result map.
> > > --- Check the nsGuiaConsulta.get-guias.
> > > --- Check the result mapping for the 'cid' property.
> > > --- Cause: com.ibatis.sqlmap.client.SqlMapException:
> > There is no statement named nsGuiaConsulta.getCID in this SqlMap.
> > >     at
> >
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
> (GeneralStatement.java:188)
> > >     at
> >
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(
> GeneralStatement.java
> > :123)
> > >     at
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(
> SqlMapExecutorDelegate.java:615)
> > >     at
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList (
> SqlMapExecutorDelegate.java:589)
> > >     at
> > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(
> SqlMapSessionImpl.java:118)
> > >     at
> > org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient (
> SqlMapClientTemplate.java:268)
> > >     at
> > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(
> SqlMapClientTemplate.java:193)
> > >     at
> >
> org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(
> SqlMapClientTemplate.java:219)
> > >     at
> > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList
> > (SqlMapClientTemplate.java:266)
> > >     at
> > br.com.crc.tiss.arquivo.data.GuiaConsultaDAO.getLoteGuias (
> GuiaConsultaDAO.java:145)
> > >     at
> > test.suites.dao.GuiaDeConsultaDAOTest.testGetLoteGuias(
> GuiaDeConsultaDAOTest.java:60)
> > >     at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> > >     at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java
> > :25)
> > >     at java.lang.reflect.Method.invoke(Method.java:324)
> > >     at
> > junit.framework.TestCase.runTest(TestCase.java:164)
> > >     at
> > junit.framework.TestCase.runBare(TestCase.java :130)
> > >     at junit.framework.TestResult$1.protect
> > (TestResult.java:106)
> > >     at
> > junit.framework.TestResult.runProtected(TestResult.java:124)
> > >     at junit.framework.TestResult.run (TestResult.java:109)
> > >     at junit.framework.TestCase.run(TestCase.java:120)
> > >     at
> > junit.framework.TestSuite.runTest(TestSuite.java:230)
> > >     at junit.framework.TestSuite.run (TestSuite.java:225)
> > >     at
> > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(
> JUnit3TestReference.java:130)
> > >     at
> > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution...java:38)
> > >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:460)
> > >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> > (RemoteTestRunner.java:673)
> > >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
> RemoteTestRunner.java:386)
> > >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (
> RemoteTestRunner.java:196)
> > > Caused by: com.ibatis.sqlmap.client.SqlMapException:
> > There is no statement named nsGuiaConsulta.getCID in this SqlMap.
> > >     at
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(
> SqlMapExecutorDelegate.java
> > :293)
> > >     at
> > com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.getMappedStatement(
> SqlMapClientImpl.java:202)
> > >     at
> >
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue(
> BasicResultMap.java
> > :471)
> > >     at
> > com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(
> BasicResultMap.java:336)
> > >     at
> > com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults (
> SqlExecutor.java:381)
> > >     at
> > com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults
> > (SqlExecutor.java:301)
> > >     at
> > com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery (
> SqlExecutor.java:190)
> > >     at
> >
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery
> (GeneralStatement.java
> > :205)
> > >     at
> >
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(
> GeneralStatement.java:173)
> > >     ... 28 more
> > >
> > > I have no idea what is wrong. I´ve read a post saying that using
> > xmlCollection java type should solve this problem.
> > >
> > > Thanks Anyway
> > >
> > >
> > >
> > >
> > > --
> > > 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.
> >
> >
> >
> > --
> > 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.
>
>
>
> --
> 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.
>
> ------------------------------
>
> This communication is for informational purposes only. It is not intended
> as an offer or solicitation for the purchase or sale of any financial
> instrument or as an official confirmation of any transaction. All market
> prices, data and other information are not warranted as to completeness or
> accuracy and are subject to change without notice. Any comments or
> statements made herein do not necessarily reflect those of JPMorgan Chase &
> Co., its subsidiaries and affiliates. This transmission may contain
> information that is privileged, confidential, legally privileged, and/or
> exempt from disclosure under applicable law. If you are not the intended
> recipient, you are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein (including any
> reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect that might
> affect any computer system into which it is received and opened, it is the
> responsibility of the recipient to ensure that it is virus free and no
> responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and
> affiliates, as applicable, for any loss or damage arising in any way from
> its use. If you received this transmission in error, please immediately
> contact the sender and destroy the material in its entirety, whether in
> electronic or hard copy format. Thank you. Please refer to *
> http://www.jpmorgan.com/pages/disclosures*<http://www..jpmorgan.com/pages/disclosures>for
disclosures relating to UK legal entities.
>
>
>
>
> --
> 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.
>
> ------------------------------
>
>  This communication is for informational purposes only. It is not intended
> as an offer or solicitation for the purchase or sale of any financial
> instrument or as an official confirmation of any transaction. All market
> prices, data and other information are not warranted as to completeness or
> accuracy and are subject to change without notice. Any comments or
> statements made herein do not necessarily reflect those of JPMorgan Chase &
> Co., its subsidiaries and affiliates. This transmission may contain
> information that is privileged, confidential, legally privileged, and/or
> exempt from disclosure under applicable law. If you are not the intended
> recipient, you are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein (including any
> reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect that might
> affect any computer system into which it is received and opened, it is the
> responsibility of the recipient to ensure that it is virus free and no
> responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and
> affiliates, as applicable, for any loss or damage arising in any way from
> its use. If you received this transmission in error, please immediately
> contact the sender and destroy the material in its entirety, whether in
> electronic or hard copy format. Thank you. Please refer to
> http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK
> legal entities.
>
>


-- 
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