ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Andersson" <mail.mi...@gmail.com>
Subject Re: problem with simple <result ... select=../>
Date Tue, 10 Apr 2007 08:37:11 GMT
Found the problem, and posting it just in case another newbie runs into it.

By habit I injected the datasource into my DAO's( in the spring
configuration), which is a big nono. When only injecting the datasource into
the sql map client it all works fine.

- Mike

On 30/03/07, Mikael Andersson <mail.micke@gmail.com> wrote:
>
> Hi guys,
> I have a problem which I suspect is solved by simple means, but I've been
> trying to solve this for the past couple of hours and I can't figure it out.
>
> I have a simple bean that contains a List of some other beans, I try to
> populate this inner list with a nested select statement. My company won't be
> happy if I post internal code,  ;(  , so if things look a little strange it
> is because I had to change it a bit.
>
>
> <select id="tstGetBond" parameterClass="int" resultMap="BondVOResultTst">
>     select .........
> </select>
> <resultMap class="BondVO" id="BondVOResultTst"
> extends="InstrumentVOResult">
>         <result column="id" property="bondRatings"
> select="dbo_INSTRUMENT.getBondRatings"/>
> </resultMap>
>
> <select id="getBondRatings" parameterClass="int"
> resultMap="BondRatingVOResult">
>         select
>             id,
>             rating
>         from
>             dbo.BOND_RATING_TABLE
>         where
>             id = #value#
> </select>
> <resultMap class="BondRatingVO" id="BondRatingVOResult">
>         <result column="id" jdbcType="NUMERIC" property="id"/>
>         <result column="rating" jdbcType="VARCHAR" property="rating"/>
> </resultMap>
>
>
> The error I get is this:
>
> --- The error occurred in com/test/sqlmap/dbo_INSTRUMENT_SqlMap.xml.
> --- The error occurred while applying a result map.
> --- Check the dbo_INSTRUMENT.BondVOResultTst.
> --- Check the result mapping for the 'bondRatings' property.
> --- Cause: java.lang.NullPointerException; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in com/test/sqlmap/dbo_MFI_INSTRUMENT_SqlMap.xml.
> --- The error occurred while applying a result map.
> --- Check the dbo_INSTRUMENT.BondVOResultTst.
> --- Check the result mapping for the 'bondRatings' property.
> --- Cause: java.lang.NullPointerException
> DEBUG (
> org.springframework.transaction.interceptor.RuleBasedTransactionAttribute)
> - Applying rules to determine whether transaction should rollback on
> org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
> operation; uncategorized SQLException for SQL []; SQL state [null]; error
> code [0];
> --- The error occurred in com/test/sqlmap/dbo_MFI_INSTRUMENT_SqlMap.xml.
> --- The error occurred while applying a result map.
> --- Check the dbo_NSTRUMENT.BondVOResultTst.
> --- Check the result mapping for the 'bondRatings' property.
> --- Cause: java.lang.NullPointerException; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in com/test/sqlmap/dbo_INSTRUMENT_SqlMap.xml.
> --- The error occurred while applying a result map.
> --- Check the dbo_MFI_INSTRUMENT.BondVOResultTst.
> --- Check the result mapping for the 'bondRatings' property.
> --- Cause: java.lang.NullPointerException
>
> Any help appreciated.
>
> Cheers,
>  Mike
>

Mime
View raw message