resultType="list" contains null values

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

resultType="list" contains null values

JohannesK
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
Reply | Threaded
Open this post in threaded view
|

Re: resultType="list" contains null values

Larry Meadors
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]