You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Yusuf <Yu...@ekalife.co.id> on 2006/08/03 11:28:22 UTC

query multiple column with Integer resultClass successfully executed

Hi, just stumbled across this, and thought i'd mention it here : 
i have a query like this 

<select id="selectDummy" parameterClass="string" resultClass="int">
	SELECT colA, colB, colC FROM table1 WHERE colB = #value#
</select>

if you noticed, i mistakenly set the resultClass as an Integer although
the query returns more than 1 column.
The data in column colA is VARCHAR, but contains numerical values like
'01200601', '01200602', and so on..

as a result, the query executed successfully without any exception, and
resulted in a List of Integers with values like 1200601, 1200602, and so
on.. out of curiosity, is this just a bug? or is it made like that? I'm
using iBATIS 2.1.7 and Oracle 8i..

thanks..
Yusuf 

Re: query multiple column with Integer resultClass successfully executed

Posted by Gwyn Evans <gw...@gmail.com>.
Well, from my reading of the docs, that's the expected behaviour (see
the "Result Maps/Primitive Results" section of the document).  If
using "int" by design, the only bug would be using something
generating more than 1 property.

/Gwyn

On 03/08/06, Yusuf <Yu...@ekalife.co.id> wrote:
> Hi, just stumbled across this, and thought i'd mention it here :
> i have a query like this
>
> <select id="selectDummy" parameterClass="string" resultClass="int">
>         SELECT colA, colB, colC FROM table1 WHERE colB = #value#
> </select>
>
> if you noticed, i mistakenly set the resultClass as an Integer although
> the query returns more than 1 column.
> The data in column colA is VARCHAR, but contains numerical values like
> '01200601', '01200602', and so on..
>
> as a result, the query executed successfully without any exception, and
> resulted in a List of Integers with values like 1200601, 1200602, and so
> on.. out of curiosity, is this just a bug? or is it made like that? I'm
> using iBATIS 2.1.7 and Oracle 8i..
>
> thanks..
> Yusuf
>