#value# moniker not recognized when called something else like #ProductId#
--------------------------------------------------------------------------

         Key: IBATISNET-66
         URL: http://issues.apache.org/jira/browse/IBATISNET-66
     Project: iBatis for .NET
        Type: Bug
    Reporter: Ron Grabowski
 Assigned to: Gilles Bayon 
    Priority: Minor


The Dev Guide:

 http://prdownloads.sourceforge.net/ibatisnet/DevGuide.pdf?download

has the following text on page 16:

 The name "value" is simply a placeholder, you can use another moniker if you 
like.

That means it should be possible to re-write this:

<!-- .NET -->
<statement id=”insertProduct” parameter=”System.Integer”>
 select * from PRODUCT where PRD_ID = #value#
</statement>

as this:

<!-- .NET -->
<statement id=”insertProduct” parameter=”System.Integer”>
 select * from PRODUCT where PRD_ID = #ProductId#
</statement>

or even like this:

<!-- .NET -->
<statement id=”insertProduct”>
 select * from PRODUCT where PRD_ID = #ProductId#
</statement>

It looks like the dev guide mistakenly uses "parameter" instead of 
"parameterClass" in its example and "insertProduct" should be called 
"getProduct". Page 16, Example 22.

When #ProductId# is used, "PreparedStatement" is logged but not "Parameters" or 
"Types". No exceptions are thrown.

I think its important to keep the parameter name the user entered in their sql 
map instead of simply replacing it with "value":

 // GOOD
 PreparedStatement : [select * from PRODUCT where PRD_ID = ?]
 Parameters: [param0=['ProductId',19]]
 Types: [param0=[String, System.Int32]]

 // NOT SO GOOD
 PreparedStatement : [select * from PRODUCT where PRD_ID = ?]
 Parameters: [param0=['value',19]]
 Types: [param0=[String, System.Int32]]

Here is another example showing #value# renamed to #year# in a <select> 
statement:

http://tinyurl.com/886oq
http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+get+around+the+N+Plus+1+selects+problem%3F

-- 
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