I wouldn't do it because I am a minimalist and it adds more mess to
the code, but if you sleep better at night knowing it's there, go for
it. :)

Hopefully you'll have a maintainer that knows *something* about XML, though.

Larry


On 12/12/06, Dave Rodenbaugh <[EMAIL PROTECTED]> wrote:


Thanks for the feedback...That all makes sense, except #4.

CDATA sections, while not necessary here, are placed there because in the
future, I probably won't be the one maintaining this code.  If someone
alters a WHERE clause to use < or >, then I've protected them from future
errors in their code.

Unless there's some fragility in the internals of iBATIS that don't handle
CDATAs well, this seems to be a generally good, forward-thinking
practice...Do you still disagree?

-D

 ________________________________
 From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Monday, December 11, 2006 5:15 PM
To: [email protected]
Subject: Re: Using parameterMaps



Several things...

1. map is OK - it is a predefined type alias
2. java.util.HashMap is OK also
3. When using parameter maps, you must specify question marks in the SQL
instead of property names.  This is likely the cause of your problem.  For
this reason, I recommend that you forego the use of explicit parameter maps
altogether, the inline syntax is much clearer IMHO
4.  You don't need CDATA here (it's not causing the problem, but I think
it's bad practice to write a CDATA section unless you really need it - in
other words, very rarely)

So, I would delete the <parameterMap> and do this instead:

<select id="findOrderMasterByStatusAndOrderType"
            parameterClass="map"
            resultClass="OrderMaster">
  <include refid="OrderMasterBase"/>
  WHERE Order_Status = #orderStatus# AND Order_Type = #orderType#
</select>

Jeff Butler


On 12/11/06, Dave Rodenbaugh <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I have a question regarding the valid values for the attribute "class"
> in the parameterMap.  So far, the docs make it clear that I can use
> pkg-qualified names there, but don't say much else.
>
> If I have:
>
>        <parameterMap id="orderByStatusAndType" class="map">
>                <parameter property="orderStatus"
> javaType="java.lang.String"/>
>                <parameter property="orderType"
> javaType="java.lang.String"/>
>        </parameterMap>
>
> That is used thusly:
>
>        <select id="findOrderMasterByStatusAndOrderType"
>
parameterMap="orderByStatusAndType"
>                          resultClass="OrderMaster">
>            <include refid="OrderMasterBase"/>
>            <![CDATA[
>            WHERE Order_Status = #orderStatus# AND Order_Type =
> #orderType#
>            ]]>
>        </select>
>
> Is 'map' a valid value in the class attribute?  If it isn't, what if I
> want to pass data that aren't represented as a class/POJO/bean, such as
> a list of parameters--(I tried passing java.util.HashMap instead without
> much success)?
>
> Thanks,
> -Dave
>
>
>


Reply via email to