ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Debasish Dutta Roy" <debasish.dutta...@gmail.com>
Subject Re: daomanager doesn't rollback transaction?
Date Wed, 02 Aug 2006 19:22:34 GMT
Though there are several possible solutions already mentioned. Let me tell
you about my experience. I had exactly the same problem.

My problem was, with this setup I was still using sqlMapClient in the dao
implementation classes.

i.e. inside this.myDao.updateParent(p); I had sqlMapClient.udpate, I did not
realize that was starting another transaction, all indiviual ones. So what I
had to do was just do this.update(p); inside the dao classes.

On 8/2/06, Jeff Butler <jeffgbutler@gmail.com> wrote:
>
> Yes - I think that's exactly the problem - too many transaction managers
> all not talking to each other.  Who's in control - SqlMap, DAO, Spring, or
> WebSphere?
>
> If you have transaction manager set to EXTERNAL, then the DAO and SqlMap
> transaction methods are ignored.
>
> With WebSphere, you should use external if you are using a session bean
> facade, otherwise external is probably not what you want.  But it also
> sounds like you want to use spring, so in that case you don't need iBATIS
> DAO manager.
>
> Jeff Butler
>
>
> On 8/2/06, Chris Lamey <clamey@localmatters.com> wrote:
> >
> >  If you have an external transaction manager set up, the *Transaction
> > calls are effectively ignored because you've told iBATIS to leave things up
> > to the external manager.
> >
> > Are you intending to use Websphere as the external manager or Spring?
> >
> > I don't know much about Websphere, but for Spring you would need to
> > configure the transaction handling in your application context.  The easiest
> > way, which requires no Java code changes, is through declarative
> > transactions:
> >
> >     http://static.springframework.org/spring/docs/1.2.x/reference/transaction.html#d0e5690
> >
> >
> > The various txn options are defined here:
> >
> >
> > http://static.springframework.org/spring/docs/2.0-m3/api/org/springframework/transaction/TransactionDefinition.html
> >
> > The basic idea is that you wrap your  DAO bean with a
> > TransactionProxyFactoryBean and configure it to use transactions on the
> > methods you want to handle as transactions.  Then Spring intercepts calls to
> > the DAO and treats them as transactions according to how you've configured
> > things.
> >
> > Cheers,
> >
> > Chris
> >
> > -----Original Message-----
> > From: Bing Lu [mailto:mfcplus@yahoo.com <mfcplus@yahoo.com>]
> >  Sent: Wed 8/2/2006 7:34 AM
> > To: user-java@ibatis.apache.org
> > Subject: RE: daomanager doesn't rollback transaction?
> >
> > I'm using oracle9 with ibatis sqlmap 2.1.7 and
> > deploying on websphere application server and have the
> > transaction set as external and I'm using spring 2.0
> > following is my code for the transaction. It's able to
> > delete but when an exception is thrown after deletion,
> > it doesn't rollback, looking forward to your opinions
> >
> > thanks
> >
> > try
> > {
> > this.daoManager.startTransaction ();
> > this.myDao.updateParent(p);
> > this.myDao.deleteChildren(p.getSeqNum());
> >
> > if(p.getChildren() != null && p.getChildren().size()
> > >0)
> > {
> > for (Iterator it=p.getChildren().iterator();
> > it.hasNext(); )
> > {
> > Child child= (Child)it.next();
> > child.setParentSeqNum(  p.getSeqNum());
> > this.myDao.insertChild(child);
> > }
> > }
> >                         this.daoManager.commitTransaction();
> > }
> > finally
> > {
> > this.daoManager.endTransaction();
> > }
> >
> > --- Chris Lamey <clamey@localmatters.com> wrote:
> >
> > > Hello,
> > >
> > > In general, at a very high level, it is safe to say
> > > that transactions in iBATIS work.  Lots of people
> > > are using them regularly without any problems with
> > > the right RDBMS configured correctly.  For example,
> > > my group successfully uses iBATIS 2.1.7 with
> > > Postgres 8.x and Spring's declarative transaction
> > > manager.
> > >
> > > However, it's hard to say whether or not anyone's
> > > had the issue you're seeing when there isn't much
> > > background information on your problem.  From what
> > > I've seen on this list, people generally get help if
> > > they send along this information along with their
> > > issue:
> > >
> > > - Vendor and version of RDBMS (Postgres 8.0, Oracle
> > > 10g, etc)
> > > - Version of iBATIS DataMapper and/or DAOs
> > > - Version of Java
> > > - Operation system type and version of the RDBMS and
> > > application
> > > - Deployment environment (standalone main
> > > application, Tomcat, JBoss, Webshere, BEA, etc)
> > > - (If applicable) Version of Abator
> > > - (If applicable) Version of Spring
> > > - Snippet of your sqlmap config file, specifically
> > > the settings and, if applicable, transactionManager
> > > elements
> > > - A write up of expection for transaction
> > > management, specifically if you're expecting iBATIS
> > > to do it or an external manager.  If it's an
> > > external manager, what is it and how is it
> > > configured.
> > >
> > > Thanks,
> > > Chris
> > >
> > > -----Original Message-----
> > > From: Bing Lu [ mailto:mfcplus@yahoo.com <mfcplus@yahoo.com>]
> > > Sent: Tue 8/1/2006 8:56 PM
> > > To: user-java@ibatis.apache.org
> > > Subject: Re: daomanager doesn't rollback
> > > transaction?
> > >
> > > anybody? no one had this issue before? or what am i
> > > doing wrong?
> > >
> > > --- Bing Lu < mfcplus@yahoo.com> wrote:
> > >
> > > > Hi, I'm using daomanager transactions. what I did
> > > > was
> > > > start a transaction, do couple inserts and a
> > > delete
> > > > and some more inserts, the problem I have is after
> > > > deletion, my insert threw an exception and didn't
> > > > finish inserting all the stuff, at this point the
> > > > daomanager should rollback to earlier stage(prior
> > > to
> > > > delete) but when I checked the database, I see the
> > > > rows have already been deleted which means the
> > > > transaction didn't rollback. Am I doing something
> > > > wrong?
> > > >
> > > > thanks
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around
> > > > http://mail.yahoo.com
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > > protection around
> > > http://mail.yahoo.com
> > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> >
>

Mime
View raw message