Brandon's correct. In addition, if you're really concerned, then just hide it yourself behind your own TX Manager class.
You'll have the same problem with Hibernate, or moreso, as Hibernate doesn't come with a DAO framework.
Cheers,
Clinton
On 5/10/05, Brandon Goodin <[EMAIL PROTECTED]> wrote:
iBatis DAO and iBatis SQL Maps are two different products. I think you
are confusing the two. IBatis DAO will work WITH HIbernate, JDO, JDBC,
SQLMaps, etc... So, when you make a decision to use iBatis DAO you are
not making a decision to commit to the iBatis SQL Maps persistence
layer.
Brandon
On 5/10/05, Rafiq, Adnan <[EMAIL PROTECTED]> wrote:
>
> I agree. My only reservation would be that we will be introducing an ibatis
> class (SqlMaps in the example you gave earlier) in the service layer. So, in
> the future if we were to move to another persistence technology, e.g.
> hibernate, this will have an impact on the services layer as well as the dao
> implementation layer.
>
> -----Original Message-----
> From: Clinton Begin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 10, 2005 1:57 PM
> To: ibatis-user-java@incubator.apache.org
> Subject: Re: Possible Connection Leak
>
>
> No, transactions are not something that should be behind the DAO layer. DAO
> abstracts persistence only. Transactions are much more coarse grained and
> are often implemented either declaratively, or programmatically in the
> service or sometimes in the presentation layer (struts plugin).
>
> Cheers,
> Clinton
>
>
>
> On 5/10/05, Rafiq, Adnan <[EMAIL PROTECTED]> wrote:
> >
> > So, if I have an interface MyDao with an implementation class called
> MyDaoImpl, what you are saying is that I should never start/commit/end
> transactions in the MyDaoImpl class.
> >
> > But, if we start referring to iBatis classes from outside the Dao,
> wouldn't that defeat the purpose of using a Dao pattern in the first place?
> >
> > -----Original Message-----
> > From: Clinton Begin [mailto:[EMAIL PROTECTED] ]
> >
> > Sent: Monday, May 09, 2005 4:05 PM
> > To: ibatis-user-java@incubator.apache.org
> > Subject: Re: Possible Connection Leak
> >
> >
> > And just to answer another question....
> >
> > NEVER call start/commit/end transaction methods from WITHIN your DAO.
> >
> > Cheers,
> > Clinton
> >
> >
> > On 5/9/05, Henry Lu <[EMAIL PROTECTED]> wrote:
> > > Exactly.
> > >
> > > -Henry
> > >
> > > Ming Xue wrote:
> > >
> > > >Do you mean I do not need Transaction in SqlMap at all (removing the
> > > >TransactionManager tag) ?
> > > >
> > > >Thanks for any clarification.
> > > >
> > > >-----Original Message-----
> > > >From: Henry Lu [mailto:[EMAIL PROTECTED]]
> > > >Sent: Monday, May 09, 2005 2:23 PM
> > > >To: ibatis-user-java@incubator.apache.org
> > > >Subject: Re: Possible Connection Leak
> > > >
> > > >
> > > >No. You config JNDI in the spring.xml instead.
> > > >
> > > >-Henry
> > > >
> > > >Ming Xue wrote:
> > > >
> > > >
> > > >
> > > >>Hi
> > > >>
> > > >>I am using the SpringDAO framework, basically the SqlMapDAOSupport
> > > >>and SqlMapTemplate, the Transaction is acturally controlled by
> > > >>Spring, in this case, how should I config the transaction of SqlMap,
> > > >>should I use External Type ?
> > > >>
> > > >> <transactionManager type="EXTERNAL">
> > > >> <dataSource type="JNDI">
> > > >> <property name="DataSource" value="java:/PlateauDS"/>
> > > >> </dataSource>
> > > >> </transactionManager>
> > > >>
> > > >>Here is my DAO
> > > >>
> > > >>public class MyDAO extends SqlMapDAOSupport implements MyDAOService
> > > >>
> > > >>{
> > > >> public void myMethod () {
> > > >>
> > > >>
> getSqlMapClientTemplate().insert("insertAccount", account);
> > > >>
> > > >> }
> > > >>
> > > >>}
> > > >>
> > > >>The transaction is started in the EJB level, which calls the DAO, and
> > > >>a EJB may call any number of DAO to do the job, in this case,
> > > >>do I need to put in the SQLMap.startTransaction in the DAO code ?
> > > >>
> > > >>Thanks
> > > >>Ming
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>[Ming Xue]
> > > >>
> > > >>
> > > >> -----Original Message-----
> > > >>*From:* Clinton Begin [mailto: [EMAIL PROTECTED]]
> > > >>*Sent:* Monday, May 09, 2005 1:04 PM
> > > >>*To:* ibatis-user-java@incubator.apache.org
> > > >>*Subject:* Re: Possible Connection Leak
> > > >>
> > > >> Yes, the approach I suggested should be used regardless of your
> > > >> transaction type.
> > > >>
> > > >> Cheers,
> > > >> Clinton
> > > >>
> > > >> On 5/9/05, *Rafiq, Adnan* <[EMAIL PROTECTED]
> > > >> <mailto: [EMAIL PROTECTED]>> wrote:
> > > >>
> > > >> Thanks Clinton.
> > > >>
> > > >> We are using session beans to manage transactions in our
> > > >> application. Moreover, since we have multiple databases
> > > >> involved we are using XA- drivers.
> > > >>
> > > >> Will the approach you mentioned still work in this scenario?
> > > >>
> > > >> -----Original Message-----
> > > >> *From:* Clinton Begin [mailto:[EMAIL PROTECTED]
> > > >> <mailto: [EMAIL PROTECTED]>]
> > > >> *Sent:* Saturday, May 07, 2005 9:30 PM
> > > >> *To:*
> ibatis-user-java@incubator.apache.org
> > > >> <mailto:
> ibatis-user-java@incubator.apache.org >
> > > >> *Subject:* Re: Possible Connection Leak
> > > >>
> > > >>
> > > >> Do ALL of your SqlMap calls follow this pattern:
> > > >>
> > > >> try {
> > > >> sqlMap.startTransaction();
> > > >> //...do work
> > > >> sqlMap.commitTransaction();
> > > >> } finally {
> > > >> sqlMap.endTransaction();
> > > >> }
> > > >>
> > > >> Clinton
> > > >>
> > > >>
> > > >> On 5/6/05, *Rafiq, Adnan* <[EMAIL PROTECTED]
> > > >> <mailto: [EMAIL PROTECTED]>> wrote:
> > > >>
> > > >> I am using a transaction manager type = JTA in my
> > > >> sql-map-config.xml file.
> > > >> After running the application for a while, I am
> > > >> getting the following
> > > >> message in my Weblogic 8.1 console:
> > > >>
> > > >> <May 6, 2005 5:09:08 PM CDT> <Warning> <Common>
> > > >> <BEA-000620> <Forcibly
> > > >> releasing
> > > >> inactive resource
> > > >>
> "[EMAIL PROTECTED]" back
> > > >> into the pool "TP_BOFA_SYS".>
> > > >>
> > > >> According to BEA, there is a connection leak
> > > >> somewhere. Is it possible that
> > > >> iBatis is not properly closing a connection after
> > > >> obtaining it?
> > > >>
> > > >> Has anyone else come across a similar issue?
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
>
>