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 Derek Alexander <D....@lse.ac.uk> on 2008/05/01 13:11:21 UTC

Error while applying a parameter map: Invalid column index.

Hi,

Two problems here, first the error itself, second I haven't yet found how to
get more info from Ibatis to debug this myself.

Maybe I've missed something obvious.

--- The error occurred while applying a parameter map.
--- Check the getFoo-InlineParameterMap.
--- Check the parameter mapping for the 'value' property.
--- Cause: java.sql.SQLException: Invalid column index

The SQL query has a long WHERE clause but only one parameter.

    <sql id="phdStudent-fragment">
                select
                        [lots of fields]
                from
                        [lots of tables]
                where
                        [lots of ANDed clauses to inner join the tables and
filter the results (but no #params#)]
    </sql>

    <select id="getFoo"
            parameterClass="string"
            resultMap="get-foo-result">
                <include refid="foo-fragment"/>
                        and
                        F.FOO_CODE = #value#
                    order by F.FOO_NAME
    </select>

Would be good at least to see the SQL being passed into the
PreparedStatement.

If anyone knows how to get Ibatis to output that or notices an obvious
mistake above, please let me know.

Thanks,
D.




-- 
View this message in context: http://www.nabble.com/Error-while-applying-a-parameter-map%3A-Invalid-column-index.-tp16993214p16993214.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Error while applying a parameter map: Invalid column index.

Posted by Derek Alexander <D....@lse.ac.uk>.
Nevermind, found the logging section at the end of the Ibatis manual which
enabled me to see that the problem was with the JDBC driver. Upgrading the
driver to a more recent version solved it.

D.
-- 
View this message in context: http://www.nabble.com/Error-while-applying-a-parameter-map%3A-Invalid-column-index.-tp16993214p16993259.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Error while applying a parameter map: Invalid column index.

Posted by Jeff Butler <je...@gmail.com>.
You can see the SQL if you enable logging.  The developers guide shows how
to do it.

Jeff Butler

On Thu, May 1, 2008 at 6:11 AM, Derek Alexander <D....@lse.ac.uk>
wrote:

>
> Hi,
>
> Two problems here, first the error itself, second I haven't yet found how
> to
> get more info from Ibatis to debug this myself.
>
> Maybe I've missed something obvious.
>
> --- The error occurred while applying a parameter map.
> --- Check the getFoo-InlineParameterMap.
> --- Check the parameter mapping for the 'value' property.
> --- Cause: java.sql.SQLException: Invalid column index
>
> The SQL query has a long WHERE clause but only one parameter.
>
>    <sql id="phdStudent-fragment">
>                select
>                        [lots of fields]
>                from
>                        [lots of tables]
>                where
>                        [lots of ANDed clauses to inner join the tables and
> filter the results (but no #params#)]
>    </sql>
>
>    <select id="getFoo"
>            parameterClass="string"
>            resultMap="get-foo-result">
>                <include refid="foo-fragment"/>
>                        and
>                        F.FOO_CODE = #value#
>                    order by F.FOO_NAME
>    </select>
>
> Would be good at least to see the SQL being passed into the
> PreparedStatement.
>
> If anyone knows how to get Ibatis to output that or notices an obvious
> mistake above, please let me know.
>
> Thanks,
> D.
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Error-while-applying-a-parameter-map%3A-Invalid-column-index.-tp16993214p16993214.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>