Quantcast

Passing both a primative & an object to MyBatis

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Passing both a primative & an object to MyBatis

jlopes151
Has anyone done this? Can it be done?

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

Larry Meadors
Yes.

On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]> wrote:
> Has anyone done this? Can it be done?
>
> Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

Josh Kamau
For primitive values , you refer to them directly in the mappers e.g #{value}

For objects , you refer to object fields directly .... e.g #{age} if there is only one parameter .if there is more than one object parameters you can qualify them with the parameter name .e.g #{person.age}

regards.
Josh.

On Fri, Apr 13, 2012 at 11:11 PM, Larry Meadors <[hidden email]> wrote:
Yes.

On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]> wrote:
> Has anyone done this? Can it be done?
>
> Thanks

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

jlopes151
In reply to this post by jlopes151
Thanks

Sent from my Verizon Wireless Phone

Larry Meadors <[hidden email]> wrote:

>Yes.
>
>On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]> wrote:
>> Has anyone done this? Can it be done?
>>
>> Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

jlopes151
In reply to this post by jlopes151
Thanks for the help.

Sent from my Verizon Wireless Phone

Josh Kamau <[hidden email]> wrote:

>For primitive values , you refer to them directly in the mappers e.g
>#{value}
>
>For objects , you refer to object fields directly .... e.g #{age} if there
>is only one parameter .if there is more than one object parameters you can
>qualify them with the parameter name .e.g #{person.age}
>
>regards.
>Josh.
>
>On Fri, Apr 13, 2012 at 11:11 PM, Larry Meadors <[hidden email]>wrote:
>
>> Yes.
>>
>> On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]> wrote:
>> > Has anyone done this? Can it be done?
>> >
>> > Thanks
>>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

jlopes151
In reply to this post by jlopes151
What would the method signature lool like?
CallMyMethod(@Param("names") String names, MyObject myobject)

Sent from my Verizon Wireless Phone

Josh Kamau <[hidden email]> wrote:

>For primitive values , you refer to them directly in the mappers e.g
>#{value}
>
>For objects , you refer to object fields directly .... e.g #{age} if there
>is only one parameter .if there is more than one object parameters you can
>qualify them with the parameter name .e.g #{person.age}
>
>regards.
>Josh.
>
>On Fri, Apr 13, 2012 at 11:11 PM, Larry Meadors <[hidden email]>wrote:
>
>> Yes.
>>
>> On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]> wrote:
>> > Has anyone done this? Can it be done?
>> >
>> > Thanks
>>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

Josh Kamau
CallMyMethod(@Param("names") String names, @Param("MyObject")MyObject myobject)

then you refer to the object in the mapper as #{myobject.property}

When ever you use more than 1 parameter, put @Param on both parameters

Josh

On Fri, Apr 13, 2012 at 11:37 PM, James Lopes <[hidden email]> wrote:
What would the method signature lool like?
CallMyMethod(@Param("names") String names, MyObject myobject)

Sent from my Verizon Wireless Phone

Josh Kamau <[hidden email]> wrote:

>For primitive values , you refer to them directly in the mappers e.g
>#{value}
>
>For objects , you refer to object fields directly .... e.g #{age} if there
>is only one parameter .if there is more than one object parameters you can
>qualify them with the parameter name .e.g #{person.age}
>
>regards.
>Josh.
>
>On Fri, Apr 13, 2012 at 11:11 PM, Larry Meadors <[hidden email]>wrote:
>
>> Yes.
>>
>> On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]> wrote:
>> > Has anyone done this? Can it be done?
>> >
>> > Thanks
>>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Passing both a primative & an object to MyBatis

jlopes151
In reply to this post by jlopes151
Thanks

Sent from my Verizon Wireless Phone

Josh Kamau <[hidden email]> wrote:

>CallMyMethod(@Param("names") String names, @Param("MyObject")MyObject
>myobject)
>
>then you refer to the object in the mapper as #{myobject.property}
>
>When ever you use more than 1 parameter, put @Param on both parameters
>
>Josh
>
>On Fri, Apr 13, 2012 at 11:37 PM, James Lopes <[hidden email]> wrote:
>
>> What would the method signature lool like?
>> CallMyMethod(@Param("names") String names, MyObject myobject)
>>
>> Sent from my Verizon Wireless Phone
>>
>> Josh Kamau <[hidden email]> wrote:
>>
>> >For primitive values , you refer to them directly in the mappers e.g
>> >#{value}
>> >
>> >For objects , you refer to object fields directly .... e.g #{age} if there
>> >is only one parameter .if there is more than one object parameters you can
>> >qualify them with the parameter name .e.g #{person.age}
>> >
>> >regards.
>> >Josh.
>> >
>> >On Fri, Apr 13, 2012 at 11:11 PM, Larry Meadors <[hidden email]
>> >wrote:
>> >
>> >> Yes.
>> >>
>> >> On Fri, Apr 13, 2012 at 2:01 PM, jlopes151 <[hidden email]>
>> wrote:
>> >> > Has anyone done this? Can it be done?
>> >> >
>> >> > Thanks
>> >>
>>
Loading...