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 Jorgen Fastrup <fa...@gmail.com> on 2007/06/27 11:26:03 UTC

Recommended best practices for integration of iBatis Data Mapper with Session EJB's ?

Hi,

I've been studying the user guide iBATIS-SqlMaps-2_en.pdf however I have not
been able to find any recommended best practices for using the iBatis
SqlMapClient from within stateless session EJB's.

Problem context:
I'm building an EAR archive from 12-15 independent EJB modules. Each EJB
module (only using stateless session beans each declared as using
"NotSupported" transactions) incorporates its DAO pattern implementation
consisting of number of hand coded JDBC SQL statements. All of DAO's access
the same database but accesses mostly different tables.

Ejb client ++++> EJB #1 +++> DAO #1  +++> Table 1, Table 2
            +
            +++> EJB #2 +++> DAO #2  +++> Table 2, Table 3
            +
            +++> EJB #3 +++> DAO #3  +++> Table 4
            +
            +++> ...        +++> ....          +++> Table X

Now I would like to replace the hand coded JDBC SQL with an implementation
that uses the iBatis SqlMapClient.


Question:
The posting
http://www.mail-archive.com/user-java@ibatis.apache.org/msg07668.htmlimplicit
suggests  that I should provide a single shared instance of the
SqlMapClient created as a (JVM) global variable by a Singleton pattern to
all of the EJB/DAO modules. However I am seriously wondering if this
singleton (potential performance "bottleneck" due to usage of the
synchronization primitive in the singleton implementation) strategy
concerning the integration of EJB's and iBatis is the official best
practice  as recommended by the iBatis team ?

Any iBatis user recommendations or experiences regarding such an integration
?


Best regrads
Jorgen Fastrup