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 Mark Bennett <ma...@gmail.com> on 2006/01/25 22:44:33 UTC
Re: Using elements
You can extend resultmaps which allow you to factor similar fields but allow
special handling for separate fields.
<resultMap id="myResult" extends="BaseMap" class="myClass">
<result property="special" column="specialCol" select="
Namespace.getFromSomeWhere"/>
</resultMap>
Mark
On 1/25/06, Rick Gray <rg...@yahoo.com> wrote:
>
> Hi,
>
> I'm evaluating IBATIS for use in our project. I need to know if I can use
> <dynamic> elements in the ParameterMaps and ResultMaps. I want to keep the
> parameters and results in sync with the statement.
>
> Thanks
>
> Rick
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
Re: Using elements
Posted by Mark Bennett <ma...@gmail.com>.
Like Jeff said, no, but you could either just allow null values into your
object. Or if you have two or three different variation of fields coming
back then you can use the extending method. But if you really need the
flexibility of being able to handle any permutation then perhaps use a
HashMap or a maybe even a custom type handler.
Mark
On 1/26/06, Rick Gray <rg...@yahoo.com> wrote:
>
> Mark, I need to know if i can build dynamic result maps and dynamic
> parameter maps using the <dynamic> element like you can in the statement.
> In other words can i use the <dynamic>, <IsNotNull> and other dynamic
> elements in the result and parameter maps? The section of code below was
> taken from the dynamic statement example in the manual.
>
> * <dynamic prepend="
> WHERE">*
> <isNotNull prepend="AND" property="firstName">
> (ACC_FIRST_NAME = #firstName#
> <isNotNull prepend="
> OR" property="lastName"> ACC_LAST_NAME = #lastName#
> </isNotNull>
> )
> </isNotNull>
> <isNotNull prepend="
> AND" property="emailAddress"> ACC_EMAIL like #emailAddress#
> </isNotNull>
> <isGreaterThan prepend="
> AND" property="id" compareValue="0"> ACC_ID = #id#
> </isGreaterThan>
> </dynamic>
>
>
>
> *Mark Bennett <ma...@gmail.com>* wrote:
>
> You can extend resultmaps which allow you to factor similar fields but
> allow special handling for separate fields.
>
> <resultMap id="myResult" extends="BaseMap" class="myClass">
> <result property="special" column="specialCol" select="
> Namespace.getFromSomeWhere"/>
> </resultMap>
>
> Mark
>
>
> On 1/25/06, Rick Gray <rgray1955@yahoo.com > wrote:
>
> Hi,
>
> I'm evaluating IBATIS for use in our project. I need to know if I can use
> <dynamic> elements in the ParameterMaps and ResultMaps. I want to keep the
> parameters and results in sync with the statement.
>
> Thanks
>
> Rick
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
Re: Using elements
Posted by Larry Meadors <lm...@apache.org>.
Why would you do that?
That makes no sense at all in a parameter map - we have the dynamic
sql so you can choose how to apply the parameters in the statement.
You can also use dyanmic sql in the select list, with a
remapResults="true", and change the returned columns.
Larry
On 1/26/06, Rick Gray <rg...@yahoo.com> wrote:
> Mark, I need to know if i can build dynamic result maps and dynamic
> parameter maps using the <dynamic> element like you can in the statement.
> In other words can i use the <dynamic>, <IsNotNull> and other dynamic
> elements in the result and parameter maps? The section of code below was
> taken from the dynamic statement example in the manual.
>
>
> <dynamic prepend="WHERE">
> <isNotNull prepend="AND" property="firstName">
> (ACC_FIRST_NAME = #firstName#
> <isNotNull prepend="OR" property="lastName">
> ACC_LAST_NAME = #lastName#
> </isNotNull>
> )
> </isNotNull>
> <isNotNull prepend="AND" property="emailAddress">
> ACC_EMAIL like #emailAddress#
> </isNotNull>
> <isGreaterThan prepend="AND" property="id" compareValue="0">
> ACC_ID = #id#
> </isGreaterThan>
> </dynamic>
>
>
>
> Mark Bennett <ma...@gmail.com> wrote:
> You can extend resultmaps which allow you to factor similar fields but allow
> special handling for separate fields.
>
> <resultMap id="myResult" extends="BaseMap" class="myClass">
> <result property="special" column="specialCol" select="
> Namespace.getFromSomeWhere"/>
> </resultMap>
>
> Mark
>
>
>
> On 1/25/06, Rick Gray <rgray1955@yahoo.com > wrote:
>
> Hi,
>
> I'm evaluating IBATIS for use in our project. I need to know if I can use
> <dynamic> elements in the ParameterMaps and ResultMaps. I want to keep the
> parameters and results in sync with the statement.
>
> Thanks
>
> Rick
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
Re: Using elements
Posted by Jeff Butler <je...@gmail.com>.
Short answer - no.
Jeff Butler
On 1/26/06, Rick Gray <rg...@yahoo.com> wrote:
>
> Mark, I need to know if i can build dynamic result maps and dynamic
> parameter maps using the <dynamic> element like you can in the statement.
> In other words can i use the <dynamic>, <IsNotNull> and other dynamic
> elements in the result and parameter maps? The section of code below was
> taken from the dynamic statement example in the manual.
>
> * <dynamic prepend="
> WHERE">*
> <isNotNull prepend="AND" property="firstName">
> (ACC_FIRST_NAME = #firstName#
> <isNotNull prepend="
> OR" property="lastName"> ACC_LAST_NAME = #lastName#
> </isNotNull>
> )
> </isNotNull>
> <isNotNull prepend="
> AND" property="emailAddress"> ACC_EMAIL like #emailAddress#
> </isNotNull>
> <isGreaterThan prepend="
> AND" property="id" compareValue="0"> ACC_ID = #id#
> </isGreaterThan>
> </dynamic>
>
>
>
> *Mark Bennett <ma...@gmail.com>* wrote:
>
> You can extend resultmaps which allow you to factor similar fields but
> allow special handling for separate fields.
>
> <resultMap id="myResult" extends="BaseMap" class="myClass">
> <result property="special" column="specialCol" select="
> Namespace.getFromSomeWhere"/>
> </resultMap>
>
> Mark
>
>
> On 1/25/06, Rick Gray <rgray1955@yahoo.com > wrote:
>
> Hi,
>
> I'm evaluating IBATIS for use in our project. I need to know if I can use
> <dynamic> elements in the ParameterMaps and ResultMaps. I want to keep the
> parameters and results in sync with the statement.
>
> Thanks
>
> Rick
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
Re: Using elements
Posted by Rick Gray <rg...@yahoo.com>.
Mark, I need to know if i can build dynamic result maps and dynamic parameter maps using the <dynamic> element like you can in the statement. In other words can i use the <dynamic>, <IsNotNull> and other dynamic elements in the result and parameter maps? The section of code below was taken from the dynamic statement example in the manual.
<dynamic prepend="WHERE">
<isNotNull prepend="AND" property="firstName">
(ACC_FIRST_NAME = #firstName#
<isNotNull prepend="OR" property="lastName">
ACC_LAST_NAME = #lastName#
</isNotNull>
)
</isNotNull>
<isNotNull prepend="AND" property="emailAddress">
ACC_EMAIL like #emailAddress#
</isNotNull>
<isGreaterThan prepend="AND" property="id" compareValue="0">
ACC_ID = #id#
</isGreaterThan>
</dynamic>
Mark Bennett <ma...@gmail.com> wrote:
You can extend resultmaps which allow you to factor similar fields but allow special handling for separate fields.
<resultMap id="myResult" extends="BaseMap" class="myClass">
<result property="special" column="specialCol" select=" Namespace.getFromSomeWhere"/>
</resultMap>
Mark
On 1/25/06, Rick Gray <rgray1955@yahoo.com > wrote: Hi,
I'm evaluating IBATIS for use in our project. I need to know if I can use <dynamic> elements in the ParameterMaps and ResultMaps. I want to keep the parameters and results in sync with the statement.
Thanks
Rick
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com