Hi!
Aaron Mulder wrote:
> Okay, let's say the connection is returned to the pool. Didn't
> you just lose all your work? After all, you executed a bunch of SQL
> statements but never called commit or rollback on the connection, and now
> it's available for someone else to use!
Hold on!!! You have used a *connection* (a pipe, something to send stuff
through, but *not* a data storage) to execute queries. All that data has
been sent to the database. The data is *not* tied to the connection as
such, it is tied to the *tx*. The connection is just a pipe we use to
shuffle our stuff through.
>
> > > 5) prepare()
> > > 6) commit()
> >
> > The devil is in the details. Look in XAResource and you will see that
> > both prepare commit and rollback is called with the tx Xid. Because of
> > this the connection in 1-4 and 5/6 doesn't have to be the same. It can
> > be a different one. After end() it is not associated with a tx anymore.
>
> Now I'm REALLY confused. You call commit in step 6 and get a
> different connection? So what work are you committing? If all the work
> was done on a different connection, there's no work to commit - or worse
> yet, you're committing someone else's work!
>
> Do you see why I'm confused?
Yes, it is because you tie the work that has been done to the
connection. Rearrange your mental view of what happens to tie the work
to the *transaction* and your brain will stop hurting :-)
Makes sense?
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com