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 JohannesK <jo...@eficode.fi> on 2010/05/20 12:57:56 UTC
resultType="list" contains null values
Hello
I am having the weirdest problem with Ibatis 3. Here is my mapper XML:
<select id="verify" resultType="list">
SELECT table_name.id_column
FROM table_name
WHERE table_name.other_column = #{parameter_id}
AND table_name.id_column IN
<foreach item="id" index="index" collection="parameter_ids" open="("
separator="," close=")">
#{id}
</foreach>
</select>
Mapper Java looks like this:
public List verify(
@Param("parameter_id") Long customerId,
@Param("parameter_ids") Long... ids);
The log tells me this:
13:48:11 DEBUG [Slf4jImpl] - <==> Executing: SELECT table_name.id_column
FROM table_name WHERE table_name.other_column = ? AND table_name.id_column
IN ( ? , ? ) >
13:48:11 DEBUG [Slf4jImpl] - <==> Parameters: 1(Long), 71(Long), 78(Long)>
13:48:11 DEBUG [Slf4jImpl] - <<== Columns: id_column>
13:48:11 DEBUG [Slf4jImpl] - <<== Row: 71>
13:48:11 DEBUG [Slf4jImpl] - <<== Row: 78>
13:48:11 DEBUG [Slf4jImpl] - <xxx Connection Closed>
The query seems to be in order and the result (based on the log) is the
right one. However, the resulting List that I receive from the mapper
contains two null values instead.
Anyone have any ideas what's going on here?
table and column names have been replaced, please excuse any mistakes
--
View this message in context: http://old.nabble.com/resultType%3D%22list%22-contains-null-values-tp28619664p28619664.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: resultType="list" contains null values
Posted by Larry Meadors <la...@gmail.com>.
You want resultType to be a bean or map or maybe even integer - list
will give you a list of lists, which is *not* what you want. :)
Larry
On Thu, May 20, 2010 at 4:57 AM, JohannesK <jo...@eficode.fi> wrote:
>
> Hello
>
> I am having the weirdest problem with Ibatis 3. Here is my mapper XML:
>
> <select id="verify" resultType="list">
> SELECT table_name.id_column
> FROM table_name
> WHERE table_name.other_column = #{parameter_id}
> AND table_name.id_column IN
> <foreach item="id" index="index" collection="parameter_ids" open="("
> separator="," close=")">
> #{id}
> </foreach>
> </select>
>
> Mapper Java looks like this:
>
> public List verify(
> @Param("parameter_id") Long customerId,
> @Param("parameter_ids") Long... ids);
>
> The log tells me this:
>
> 13:48:11 DEBUG [Slf4jImpl] - <==> Executing: SELECT table_name.id_column
> FROM table_name WHERE table_name.other_column = ? AND table_name.id_column
> IN ( ? , ? ) >
> 13:48:11 DEBUG [Slf4jImpl] - <==> Parameters: 1(Long), 71(Long), 78(Long)>
> 13:48:11 DEBUG [Slf4jImpl] - <<== Columns: id_column>
> 13:48:11 DEBUG [Slf4jImpl] - <<== Row: 71>
> 13:48:11 DEBUG [Slf4jImpl] - <<== Row: 78>
> 13:48:11 DEBUG [Slf4jImpl] - <xxx Connection Closed>
>
>
> The query seems to be in order and the result (based on the log) is the
> right one. However, the resulting List that I receive from the mapper
> contains two null values instead.
>
> Anyone have any ideas what's going on here?
>
> table and column names have been replaced, please excuse any mistakes
> --
> View this message in context: http://old.nabble.com/resultType%3D%22list%22-contains-null-values-tp28619664p28619664.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org