ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olaf Bey" <olaf....@gmail.com>
Subject Re: Problem with complex properties mapping
Date Mon, 08 May 2006 13:37:49 GMT
Hallo Torsten,

you could substitute "<select" with *<statement...*. This should work, I
hope.

Greetings,

Olaf

On 5/8/06, Michal Bartmanski <michal.bartmanski@star-trac.de> wrote:
>
> Hi Torsten,
>
> i thnk you're missing a parameterMap or parameterClass attribute in
> getColorForArticle statement.
>
> gruss
> michal
>
>
> -----Urspr√ľngliche Nachricht-----
> Von: Torsten Michelmann [mailto:torsten.michelmann@gmx.de]
> Gesendet: Montag, 8. Mai 2006 11:55
> An: user-java@ibatis.apache.org
> Betreff: Problem with complex properties mapping
>
>
> Hi,
>
> I am new to DataMapper and it might be that my problem is rather easy to
> spot so please bear with me if the problem is trivial but I was not able
> to
> solve it for a few days now and I would be glad for any help.
>
> I am running queries against an AS/400 using
> com.ibm.as400.access.AS400JDBCDriver
>
> The error message that I get is
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in so/global/persistence/map/pdm/Tobas_SqlMap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getColorForArticle-InlineParameterMap.
> --- Check the parameter mapping for the 'sais' property.
> --- Cause: java.lang.ArrayIndexOutOfBoundsException: 1
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>         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:610)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(
> SqlMapExecutorDelegate.java:584)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(
> SqlMapSessionImpl.java:101)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(
> SqlMapClientImpl.java:78)
>
> And the mapping looks like
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMap
> PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-2.dtd">
>
> <sqlMap namespace="MyApp">
>         <resultMap id="readArticles_Result" class="Article">
>                 <result property="articleKey.articleId" column="articleid"
> />
>                 <result property="articleName" column="fobz" />
>                 <result property="formGroupKey.formGroupId" column="fogr"
> />
>                 <result property="articleColoursList"
>
>                         column="{finr=finr,sais=sais,koll=koll,form=form,arnr=arnr}"
> select="getColorForArticle" />
>         </resultMap>
>         <resultMap id="getColor_Result" class="ArticleColourBase">
>                 <result property="articleColourKey.articleColourId"
>                         column="fbnr" />
>                 <result property="label" column="fbez" />
>         </resultMap>
>
>         <select id="readArticlesByCollection"
> parameterClass="CollectionKey"
>                 resultMap="readArticles_Result">
>                 <![CDATA[
>                 select distinct a.koll concat '.' concat a.sais concat '.'
> concat
> substr(a.form, 3) concat '.' concat substr(a.arnr, 3) articleid ,
> a.sais
> sais, a.koll koll , a.form form, a.arnr arnr, a.fogr fogr, a.finr finr,
> a.fobz fobz
>                 from sodta.bavksl a
>                 where
>                 a.finr= (select distinct finr from sodta.bckollp where
> finr<= '060'  and
> sgmt=#segmentId#  and glkz='J'  )
>                 and     ( a.sais= #seasonId#  or sais ='899')  and a.kollin (select koll
from
> sodta.bckollp where finr<= '060'
>                 and sgmt=#segmentId#  and glkz='J'  ) and a.glkz='A'
>                 order by articleid
>                 ]]>
>         </select>
>
>         <select id="getColorForArticle" resultMap="getColor_Result">
>                 <![CDATA[
>                 select distinct a.fbnr fbnr,
>                 case when a.fbez = ''
>                 then b.fbez else a.fbez end fbez
>                 from sodta.bavfsl a left outer join sodta.bavfnl b
>                 on a.finr=b.finr
>                 and a.sais=b.sais and a.koll=b.koll and a.fbnr=b.fbnr
>                 where a.finr = #finr# and a.sais = #sais# and a.koll =
> #koll# and a.form =
> #form# and a.vacp='' and a.arnr= #arnr#
>                 and a.glkz='A' order by fbnr
>         ]]>
>         </select>
> </sqlMap>
>
> I have experimented with the parameter sequence of
> <result property="articleColoursList"
> column="{finr=finr,sais=sais,koll=koll,form=form,arnr=arnr}"
> select="getColorForArticle" /> but this did not yield any results.
> A test of complex properties mapping using a simple data setup was
> successful, so I am now out of ideas.
> Any help would be appreciated.
>
> Greetings
> Torsten
>
> --
> Greetings
> Torsten
>
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
>

Mime
View raw message