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 "Merritt, Norris" <no...@hp.com> on 2006/07/10 19:58:30 UTC

Why is parameterMap processing positional?

It seems to me that if I have a parameterMap of type map, with various
named values in the map, and associate this parameterMap with a
statement, I should be able to specify placeholders in the statement of
the form #foo#  and #bar#  where 'foo' and 'bar' match names of values
which exist in the hashmap for the parameterMap.  However, this doesn't
work. It appears that I must specify only ? for placeholders in the
statement, or I get "parameter index out of range" exceptions thrown by
my jdbc driver.  And because all the placeholders are ? then the order
of the parameter properties in the parameterMap becomes critical.

I don't like this positional behavior. Does specifiying statement
placeholders of the form #foo# only work where the parameters are coming
from bean properties?


Re: Why is parameterMap processing positional?

Posted by Jeff Butler <je...@gmail.com>.
For this reason we recommend using inline parameters rather than parameter
maps.  They are just as functional, and more intuitive.

Jeff Butler


On 7/10/06, Merritt, Norris <no...@hp.com> wrote:
>
>   It seems to me that if I have a parameterMap of type map, with various
> named values in the map, and associate this parameterMap with a statement, I
> should be able to specify placeholders in the statement of the form #foo#
> and #bar#  where 'foo' and 'bar' match names of values which exist in the
> hashmap for the parameterMap.  However, this doesn't work. It appears that I
> must specify only ? for placeholders in the statement, or I get "parameter
> index out of range" exceptions thrown by my jdbc driver.  And because all
> the placeholders are ? then the order of the parameter properties in the
> parameterMap becomes critical.
>
> I don't like this positional behavior. Does specifiying statement
> placeholders of the form #foo# only work where the parameters are coming
> from bean properties?
>