Make parameter maps work like inline parameters, no matter count and/or order
-----------------------------------------------------------------------------

         Key: IBATIS-214
         URL: http://issues.apache.org/jira/browse/IBATIS-214
     Project: iBatis for Java
        Type: New Feature
  Components: SQL Maps  
    Versions: 2.1.5    
 Environment: iBATIS SQL Maps 2.1.5.582
    Reporter: Daniel Silva


When using parameter maps and in your statement you use same parameter more 
than once, you need to redeclare this parameter at your parameter map tied to 
order and count of those parameters in your mapped statement.

So, in situations like this:

<select id="foo" parameterMap="fooMap">
   select *
       from foo a, bar b
   where b.fooId = a.id
       and a.myfield = ?
       and b.anotherfield = ?
</select>

My fooMap parameter map must look like this:

<parameterMap id="fooMap" class="com.foo.Blah">
  <parameter property="param"/>
  <parameter property="param"/>
</parameterMap>

Proposal is to change the way parameter maps work currently to something like 
inline parameters:

<parameterMap id="fooMap" class="com.foo.Blah">
  <parameter property="param"/>
</parameterMap>


<select id="foo" parameterMap="fooMap">
   select *
       from foo a, bar b
   where b.fooId = a.id
       and a.myfield = #param#
       and b.anotherfield = #param#
</select>

Maybe it could be useful to add an attribute to the <parameter/> element to 
mimic the way result maps work. So we'd have something like:

<parameter property="param" inline="blah"/>

and then:

<select id="foo" parameterMap="myMap">
   select *
       from foo a, bar b
   where b.fooId = a.id
       and a.myfield = #blah#
       and b.anotherfield = #blah#
</select>

Not sure 'inline' would be such a good name for this attribute so do what you 
think is the best.

Any comments appreciated.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to