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 problem with simple <result ... select=../>
Date Fri, 30 Mar 2007 14:09:08 GMT
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