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 swaroop belur <sw...@gmail.com> on 2009/07/22 15:13:47 UTC

Questions regd ibatis best practices - need some help here

Hello all,

Is there any pointer/link or document which suggests using certain features
over others to achieve the same goal
to improve performance for example.  

1. Like for instance when executing an update query , we can either specify
parameterClass or parameterMap 
Which one is preferred  and why? 

2. Related to above - The cost of reflection while marshalling results. 
    eg. For  [1]  is there any relation to reflection or both are same

3. I was using ibator to generate some code today and observed by default it
does NOT generate any paramterMaps
Any reason for this. I hope this is the right forum to ask this question.It
generates paramterClass where requied and no maps

4. Also  is there any disadvantage  of using java.util.Map for providing
parameters instead of a Java Bean. Again any demerits
over using bean? 

5. Last - I am new and learning ibatis - is there any Best Practice FAQ . I
did search for best practices in this forum - but 
was not convinced i found answers to my questions. 

I am trying to understand how much better from both developing and
performance point will Spring-Ibatis integration
be better than Spring-JDBC integration

Really appreciate any response.

Thanks
sbelur






-- 
View this message in context: http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-here-tp24606061p24606061.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Questions regd ibatis best practices - need some help here

Posted by Clinton Begin <cl...@gmail.com>.
LOL... I have a feeling that we'll deprecate them, but kind of like how Sun
deprecated the Date methods.  They'll always be there.
Don't be offended by the strikethroughs in the documentation.  :-)

Clinton

On Mon, Jul 27, 2009 at 1:04 PM, Hugh Ross <hh...@gmail.com> wrote:

> Sorry to hear about the deprecation of Parameter Maps in iBATIS3.  I
> like them for keeping the SQL parts of our SqlMaps cleaner.  Also
> seems consistent with use of Result Maps for Selects...
>
> On 7/24/09, Jeff Butler <je...@gmail.com> wrote:
> > You don't need a parameter map for procedures in iBATIS2.  This is
> > from the developers guide, page 30:
> >
> > <procedure id=“callProcedure” parameterClass=”com.mydomain.MyParameter”>
> > {call MyProcedure (#parm1,jdbcType=INTEGER,mode=IN#,
> >   #parm2,jdbcType=INTEGER,mode=IN#,
> >   #parm3,jdbcType=DECIMAL,mode=OUT,numericScale=2#)}
> > </procedure>
> >
> > Similar in iBATIS3.
> >
> > Jeff Butler
> >
> >
> > 2009/7/24 Andrey Rogov <ko...@gmail.com>:
> > > Jeff,
> > > If Map parameter will be deprecated,
> > > how we can run stored procedures in 3x version ?
> > >
> > > -----Original Message-----
> > > From: Jeff Butler [mailto:jeffgbutler@gmail.com]
> > > Sent: Friday, July 24, 2009 7:05 PM
> > > To: user-java@ibatis.apache.org
> > > Subject: Re: Questions regd ibatis best practices - need some help here
> > >
> > > iBATIS 3 is in development and is not formally released yet.  However,
> > > I can vouch that it is nearly function complete and pretty stable.
> > > You can check it out from Subversion and build it with Maven if you're
> > > interested in trying it.  Here's the SVN link:
> > >
> > > http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/
> > >
> > > BTW - there's no published documentation yet - so look to the test
> > > cases to see how to use it.
> > >
> > > Jeff Butler
> > >
> > >
> > >
> > > On Fri, Jul 24, 2009 at 12:38 AM, swaroop belur<
> swaroop.belur@gmail.com>
> > > wrote:
> > >>
> > >>
> > >> Hi Jeff
> > >>
> > >> This is really good.  This kind of reply will really help us
> developers to
> > >> use ibatis in correct way.
> > >> I was struggling for couple of weeks to use ibatis the right way.
> > >>
> > >> Right now i can see the download link for ibatis  2.3.4 . May i know
> when
> > >> ibatis 3 can be downloaded.
> > >>
> > >> Thanks for your time.
> > >>
> > >> -swaroop
> > >>
> > >>
> > >>
> > >>
> > >> swaroop belur wrote:
> > >>>
> > >>> Hello all,
> > >>>
> > >>> Is there any pointer/link or document which suggests using certain
> > >>> features over others to achieve the same goal
> > >>> to improve performance for example.
> > >>>
> > >>> 1. Like for instance when executing an update query , we can either
> > >>> specify parameterClass or parameterMap
> > >>> Which one is preferred  and why?
> > >>>
> > >>> 2. Related to above - The cost of reflection while marshalling
> results.
> > >>>     eg. For  [1]  is there any relation to reflection or both are
> same
> > >>>
> > >>> 3. I was using ibator to generate some code today and observed by
> default
> > >>> it does NOT generate any paramterMaps
> > >>> Any reason for this. I hope this is the right forum to ask this
> > >>> question.It generates paramterClass where requied and no maps
> > >>>
> > >>> 4. Also  is there any disadvantage  of using java.util.Map for
> providing
> > >>> parameters instead of a Java Bean. Again any demerits
> > >>> over using bean?
> > >>>
> > >>> 5. Last - I am new and learning ibatis - is there any Best Practice
> FAQ .
> > >>> I did search for best practices in this forum - but
> > >>> was not convinced i found answers to my questions.
> > >>>
> > >>> I am trying to understand how much better from both developing and
> > >>> performance point will Spring-Ibatis integration
> > >>> be better than Spring-JDBC integration
> > >>>
> > >>> Really appreciate any response.
> > >>>
> > >>> Thanks
> > >>> sbelur
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>
> > >> --
> > >> View this message in context:
> > >
> http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-
> > > here-tp24606061p24638908.html
> > >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> > >>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > > For additional commands, e-mail: user-java-help@ibatis.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > > For additional commands, e-mail: user-java-help@ibatis.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: Questions regd ibatis best practices - need some help here

Posted by Hugh Ross <hh...@gmail.com>.
Sorry to hear about the deprecation of Parameter Maps in iBATIS3.  I
like them for keeping the SQL parts of our SqlMaps cleaner.  Also
seems consistent with use of Result Maps for Selects...

On 7/24/09, Jeff Butler <je...@gmail.com> wrote:
> You don't need a parameter map for procedures in iBATIS2.  This is
> from the developers guide, page 30:
>
> <procedure id=“callProcedure” parameterClass=”com.mydomain.MyParameter”>
> {call MyProcedure (#parm1,jdbcType=INTEGER,mode=IN#,
>   #parm2,jdbcType=INTEGER,mode=IN#,
>   #parm3,jdbcType=DECIMAL,mode=OUT,numericScale=2#)}
> </procedure>
>
> Similar in iBATIS3.
>
> Jeff Butler
>
>
> 2009/7/24 Andrey Rogov <ko...@gmail.com>:
> > Jeff,
> > If Map parameter will be deprecated,
> > how we can run stored procedures in 3x version ?
> >
> > -----Original Message-----
> > From: Jeff Butler [mailto:jeffgbutler@gmail.com]
> > Sent: Friday, July 24, 2009 7:05 PM
> > To: user-java@ibatis.apache.org
> > Subject: Re: Questions regd ibatis best practices - need some help here
> >
> > iBATIS 3 is in development and is not formally released yet.  However,
> > I can vouch that it is nearly function complete and pretty stable.
> > You can check it out from Subversion and build it with Maven if you're
> > interested in trying it.  Here's the SVN link:
> >
> > http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/
> >
> > BTW - there's no published documentation yet - so look to the test
> > cases to see how to use it.
> >
> > Jeff Butler
> >
> >
> >
> > On Fri, Jul 24, 2009 at 12:38 AM, swaroop belur<sw...@gmail.com>
> > wrote:
> >>
> >>
> >> Hi Jeff
> >>
> >> This is really good.  This kind of reply will really help us developers to
> >> use ibatis in correct way.
> >> I was struggling for couple of weeks to use ibatis the right way.
> >>
> >> Right now i can see the download link for ibatis  2.3.4 . May i know when
> >> ibatis 3 can be downloaded.
> >>
> >> Thanks for your time.
> >>
> >> -swaroop
> >>
> >>
> >>
> >>
> >> swaroop belur wrote:
> >>>
> >>> Hello all,
> >>>
> >>> Is there any pointer/link or document which suggests using certain
> >>> features over others to achieve the same goal
> >>> to improve performance for example.
> >>>
> >>> 1. Like for instance when executing an update query , we can either
> >>> specify parameterClass or parameterMap
> >>> Which one is preferred  and why?
> >>>
> >>> 2. Related to above - The cost of reflection while marshalling results.
> >>>     eg. For  [1]  is there any relation to reflection or both are same
> >>>
> >>> 3. I was using ibator to generate some code today and observed by default
> >>> it does NOT generate any paramterMaps
> >>> Any reason for this. I hope this is the right forum to ask this
> >>> question.It generates paramterClass where requied and no maps
> >>>
> >>> 4. Also  is there any disadvantage  of using java.util.Map for providing
> >>> parameters instead of a Java Bean. Again any demerits
> >>> over using bean?
> >>>
> >>> 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
> >>> I did search for best practices in this forum - but
> >>> was not convinced i found answers to my questions.
> >>>
> >>> I am trying to understand how much better from both developing and
> >>> performance point will Spring-Ibatis integration
> >>> be better than Spring-JDBC integration
> >>>
> >>> Really appreciate any response.
> >>>
> >>> Thanks
> >>> sbelur
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> > http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-
> > here-tp24606061p24638908.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Questions regd ibatis best practices - need some help here

Posted by Jeff Butler <je...@gmail.com>.
You don't need a parameter map for procedures in iBATIS2.  This is
from the developers guide, page 30:

<procedure id=“callProcedure” parameterClass=”com.mydomain.MyParameter”>
{call MyProcedure (#parm1,jdbcType=INTEGER,mode=IN#,
   #parm2,jdbcType=INTEGER,mode=IN#,
   #parm3,jdbcType=DECIMAL,mode=OUT,numericScale=2#)}
</procedure>

Similar in iBATIS3.

Jeff Butler


2009/7/24 Andrey Rogov <ko...@gmail.com>:
> Jeff,
> If Map parameter will be deprecated,
> how we can run stored procedures in 3x version ?
>
> -----Original Message-----
> From: Jeff Butler [mailto:jeffgbutler@gmail.com]
> Sent: Friday, July 24, 2009 7:05 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Questions regd ibatis best practices - need some help here
>
> iBATIS 3 is in development and is not formally released yet.  However,
> I can vouch that it is nearly function complete and pretty stable.
> You can check it out from Subversion and build it with Maven if you're
> interested in trying it.  Here's the SVN link:
>
> http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/
>
> BTW - there's no published documentation yet - so look to the test
> cases to see how to use it.
>
> Jeff Butler
>
>
>
> On Fri, Jul 24, 2009 at 12:38 AM, swaroop belur<sw...@gmail.com>
> wrote:
>>
>>
>> Hi Jeff
>>
>> This is really good.  This kind of reply will really help us developers to
>> use ibatis in correct way.
>> I was struggling for couple of weeks to use ibatis the right way.
>>
>> Right now i can see the download link for ibatis  2.3.4 . May i know when
>> ibatis 3 can be downloaded.
>>
>> Thanks for your time.
>>
>> -swaroop
>>
>>
>>
>>
>> swaroop belur wrote:
>>>
>>> Hello all,
>>>
>>> Is there any pointer/link or document which suggests using certain
>>> features over others to achieve the same goal
>>> to improve performance for example.
>>>
>>> 1. Like for instance when executing an update query , we can either
>>> specify parameterClass or parameterMap
>>> Which one is preferred  and why?
>>>
>>> 2. Related to above - The cost of reflection while marshalling results.
>>>     eg. For  [1]  is there any relation to reflection or both are same
>>>
>>> 3. I was using ibator to generate some code today and observed by default
>>> it does NOT generate any paramterMaps
>>> Any reason for this. I hope this is the right forum to ask this
>>> question.It generates paramterClass where requied and no maps
>>>
>>> 4. Also  is there any disadvantage  of using java.util.Map for providing
>>> parameters instead of a Java Bean. Again any demerits
>>> over using bean?
>>>
>>> 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
>>> I did search for best practices in this forum - but
>>> was not convinced i found answers to my questions.
>>>
>>> I am trying to understand how much better from both developing and
>>> performance point will Spring-Ibatis integration
>>> be better than Spring-JDBC integration
>>>
>>> Really appreciate any response.
>>>
>>> Thanks
>>> sbelur
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
> http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-
> here-tp24606061p24638908.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: Questions regd ibatis best practices - need some help here

Posted by Andrey Rogov <ko...@gmail.com>.
Jeff, 
If Map parameter will be deprecated, 
how we can run stored procedures in 3x version ?

-----Original Message-----
From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Friday, July 24, 2009 7:05 PM
To: user-java@ibatis.apache.org
Subject: Re: Questions regd ibatis best practices - need some help here

iBATIS 3 is in development and is not formally released yet.  However,
I can vouch that it is nearly function complete and pretty stable.
You can check it out from Subversion and build it with Maven if you're
interested in trying it.  Here's the SVN link:

http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/

BTW - there's no published documentation yet - so look to the test
cases to see how to use it.

Jeff Butler



On Fri, Jul 24, 2009 at 12:38 AM, swaroop belur<sw...@gmail.com>
wrote:
>
>
> Hi Jeff
>
> This is really good.  This kind of reply will really help us developers to
> use ibatis in correct way.
> I was struggling for couple of weeks to use ibatis the right way.
>
> Right now i can see the download link for ibatis  2.3.4 . May i know when
> ibatis 3 can be downloaded.
>
> Thanks for your time.
>
> -swaroop
>
>
>
>
> swaroop belur wrote:
>>
>> Hello all,
>>
>> Is there any pointer/link or document which suggests using certain
>> features over others to achieve the same goal
>> to improve performance for example.
>>
>> 1. Like for instance when executing an update query , we can either
>> specify parameterClass or parameterMap
>> Which one is preferred  and why?
>>
>> 2. Related to above - The cost of reflection while marshalling results.
>>     eg. For  [1]  is there any relation to reflection or both are same
>>
>> 3. I was using ibator to generate some code today and observed by default
>> it does NOT generate any paramterMaps
>> Any reason for this. I hope this is the right forum to ask this
>> question.It generates paramterClass where requied and no maps
>>
>> 4. Also  is there any disadvantage  of using java.util.Map for providing
>> parameters instead of a Java Bean. Again any demerits
>> over using bean?
>>
>> 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
>> I did search for best practices in this forum - but
>> was not convinced i found answers to my questions.
>>
>> I am trying to understand how much better from both developing and
>> performance point will Spring-Ibatis integration
>> be better than Spring-JDBC integration
>>
>> Really appreciate any response.
>>
>> Thanks
>> sbelur
>>
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context:
http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-
here-tp24606061p24638908.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Questions regd ibatis best practices - need some help here

Posted by Jeff Butler <je...@gmail.com>.
iBATIS 3 is in development and is not formally released yet.  However,
I can vouch that it is nearly function complete and pretty stable.
You can check it out from Subversion and build it with Maven if you're
interested in trying it.  Here's the SVN link:

http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/

BTW - there's no published documentation yet - so look to the test
cases to see how to use it.

Jeff Butler



On Fri, Jul 24, 2009 at 12:38 AM, swaroop belur<sw...@gmail.com> wrote:
>
>
> Hi Jeff
>
> This is really good.  This kind of reply will really help us developers to
> use ibatis in correct way.
> I was struggling for couple of weeks to use ibatis the right way.
>
> Right now i can see the download link for ibatis  2.3.4 . May i know when
> ibatis 3 can be downloaded.
>
> Thanks for your time.
>
> -swaroop
>
>
>
>
> swaroop belur wrote:
>>
>> Hello all,
>>
>> Is there any pointer/link or document which suggests using certain
>> features over others to achieve the same goal
>> to improve performance for example.
>>
>> 1. Like for instance when executing an update query , we can either
>> specify parameterClass or parameterMap
>> Which one is preferred  and why?
>>
>> 2. Related to above - The cost of reflection while marshalling results.
>>     eg. For  [1]  is there any relation to reflection or both are same
>>
>> 3. I was using ibator to generate some code today and observed by default
>> it does NOT generate any paramterMaps
>> Any reason for this. I hope this is the right forum to ask this
>> question.It generates paramterClass where requied and no maps
>>
>> 4. Also  is there any disadvantage  of using java.util.Map for providing
>> parameters instead of a Java Bean. Again any demerits
>> over using bean?
>>
>> 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
>> I did search for best practices in this forum - but
>> was not convinced i found answers to my questions.
>>
>> I am trying to understand how much better from both developing and
>> performance point will Spring-Ibatis integration
>> be better than Spring-JDBC integration
>>
>> Really appreciate any response.
>>
>> Thanks
>> sbelur
>>
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-here-tp24606061p24638908.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Questions regd ibatis best practices - need some help here

Posted by swaroop belur <sw...@gmail.com>.

Hi Jeff

This is really good.  This kind of reply will really help us developers to
use ibatis in correct way.
I was struggling for couple of weeks to use ibatis the right way.

Right now i can see the download link for ibatis  2.3.4 . May i know when
ibatis 3 can be downloaded.

Thanks for your time.

-swaroop




swaroop belur wrote:
> 
> Hello all,
> 
> Is there any pointer/link or document which suggests using certain
> features over others to achieve the same goal
> to improve performance for example.  
> 
> 1. Like for instance when executing an update query , we can either
> specify parameterClass or parameterMap 
> Which one is preferred  and why? 
> 
> 2. Related to above - The cost of reflection while marshalling results. 
>     eg. For  [1]  is there any relation to reflection or both are same
> 
> 3. I was using ibator to generate some code today and observed by default
> it does NOT generate any paramterMaps
> Any reason for this. I hope this is the right forum to ask this
> question.It generates paramterClass where requied and no maps
> 
> 4. Also  is there any disadvantage  of using java.util.Map for providing
> parameters instead of a Java Bean. Again any demerits
> over using bean? 
> 
> 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
> I did search for best practices in this forum - but 
> was not convinced i found answers to my questions. 
> 
> I am trying to understand how much better from both developing and
> performance point will Spring-Ibatis integration
> be better than Spring-JDBC integration
> 
> Really appreciate any response.
> 
> Thanks
> sbelur
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-here-tp24606061p24638908.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Questions regd ibatis best practices - need some help here

Posted by Jeff Butler <je...@gmail.com>.
1. I prefer parameterClass - I think it is much easier to
maintain/read.  And note that parameterMap is deprecated in iBATIS 3.

2. There should be very little difference - with parameterClass iBATIS
generates a parameterMap at startup.

3. See  #1

4. There is a theoretical performance hit from using maps as
parameters rather than a JavaBean.  But it is so insignificant that
it's nothing to worry about.

5. There's no best practices FAQ currently - maybe it would be a good
idea to start one.  Here's are some thoughts (these are my opinions
only):

- Make sure there is only one instance of the SqlMapClient - put it in
a singleton, or a Spring container, or a web container's application
scope (this is not just opinion - you should definitely do this)
- Avoid parameterMaps (optional in iBATIS2, deprecated in iBATIS3)
- Use statement namespaces (optional in iBATIS2, required in iBATIS3)
- Keep things simple - use simple getters/setters for all properties
in JavaBeans
- Keep things simple - do not get caught up in using <sql> fragments
to avoid rewriting common SQL phrases - favor readability.  It's SQL -
not Java code!
- Ignore all iBATIS2 settings related to maxSessions, maxTransactions,
maxRequests.  These no longer have any effect in iBATIS2 and are
removed in iBATIS3
- Be skeptical about the benefits of lazy loading.  This is a
seductive feature, but probably has little measurable benefit in most
real world applications.
- Understand and utilize the transactional environment of your container
- Understand SQL optimization.  Any performance issues are far more
likely to be related to poor SQL performance than any issue with
iBATIS.
- Do not use the deprecated iBATIS DAO framework - use Spring instead
- Understand what iBATIS caching really does - iBATIS caches
statements, not objects or tables

Anybody have others?


Jeff Butler




On Wed, Jul 22, 2009 at 8:13 AM, swaroop belur<sw...@gmail.com> wrote:
>
> Hello all,
>
> Is there any pointer/link or document which suggests using certain features
> over others to achieve the same goal
> to improve performance for example.
>
> 1. Like for instance when executing an update query , we can either specify
> parameterClass or parameterMap
> Which one is preferred  and why?
>
> 2. Related to above - The cost of reflection while marshalling results.
>    eg. For  [1]  is there any relation to reflection or both are same
>
> 3. I was using ibator to generate some code today and observed by default it
> does NOT generate any paramterMaps
> Any reason for this. I hope this is the right forum to ask this question.It
> generates paramterClass where requied and no maps
>
> 4. Also  is there any disadvantage  of using java.util.Map for providing
> parameters instead of a Java Bean. Again any demerits
> over using bean?
>
> 5. Last - I am new and learning ibatis - is there any Best Practice FAQ . I
> did search for best practices in this forum - but
> was not convinced i found answers to my questions.
>
> I am trying to understand how much better from both developing and
> performance point will Spring-Ibatis integration
> be better than Spring-JDBC integration
>
> Really appreciate any response.
>
> Thanks
> sbelur
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-here-tp24606061p24606061.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org