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<swaroop.be...@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-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>

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

Reply via email to