ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Speranza <marco.speranz...@gmail.com>
Subject Little question about type check between resultMap and java return type
Date Thu, 28 Jan 2010 14:07:08 GMT
Hi all

I have notice an unusual behaviour of ibatis result object mapping.
Mapping a query result with a wrong ResultMap, no error is thrown.

 My xml mapper is:

<select id="getSizeItems" resultMap="SizeResult">
    SELECT
            SIZE_ID,
            DESCRIPTION
    FROM MY_TABLE
</select>

My resultMap into xml file is:

<resultMap type="JavaBeanOne" id="SizeResult">
   <result column="ID" property="name" />
   <result column="LOCATION" property="position" />
</resultMap>

and my java interface is:

public List < JavaBeanTwo > getSizeItems() throws SQLException;

The error is that the related java type for the result map, 'SizeResult', is
different from  the one specified into interface method signature.
Furthermore no column returned from the Select statement matched related
ResultMap.
 For this scenario ibatis returns a list of items filled with null object,
the number of elements was the one retrieved from database.

I will like to know if that is the right behaviour of ibatis.
How can I catch the bugs derived from wrong mapping ?

Thanks a lot.



-- 
Marco Speranza <marco.speranza79@gmail.com>

Mime
View raw message