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:[EMAIL PROTECTED] 
Sent: dinsdag 28 augustus 2007 18:55
To: [email protected]
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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] 
Sent: maandag 27 augustus 2007 23:45
To: [email protected]
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. 

Reply via email to