Hi Kenneth,

The EJB 1.1 and 2.0 specs say that the container needs to support flat
transactions and the JTA API which in turn supports distributed
transactions.  The container is a transaction manager that works with the
master transaction manager, the distributed transaction coordinator (that
lives somewhere).  Two-phase commit is a very popular and common process for
performing distributed transactions.

In your example, the database updates are not done until the second phase of
the commits is being done.  If there is an abort vote by the container or
your code in thte first phase, there is nothing to roll back, just a discard
of proposed changes.  This is part of the concept of isolation.

I have no financial interest or otherwise in his book, but I found Chapter
11 of Ed Roman's book,
http://theserverside.com/resources/ejb-book-roman.zip, helpful in
understanding more about transactions and isolation than the EJB specs
provide.

I hope this is helpful.
-Chris

-----Original Message-----
From: Kenneth D. Litwak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 30, 2000 8:05 PM
Subject: Two phase commit "support": if a and b and c and q when i does
o


Ihav e some questions about the EJB spec saying that a container must
support
two-phase commit.  I know what a two-phase commit is. I owned code at IBM to
do it for DB2/MVS.  What I don't understand is what the term "supports'
means
here.  Since the container isn't a database enginre, what items in a
container
have to vote on doing commit phase 2 during commit phase 1?  What's more, I
can imagein all kinds of scenarios that essentailly make this notion
useless.
Trans 1 starts (CMT or BMT)
Session bean method A is called
Method A calls methods B, C and D of three separate entity beans, which map
to
two separate databases, Sybase and Oracle.
The database updates are done,method A completes
The container's TM calls commit on the transaction.
This causes, I'm assuming, a commit call against both the Oracle and Sybase
database.  The Sybase update succeeds (I worked there, so I have to tive
htem
some credit).  THe Oracle update fails.  Having th3 container do a two-phase
commit here is totally irrelevant so far as I can see, since the TM cannot
rollback the committed changes in the Sybase database.  The transaction can
be
rolled back, which might cau;se a rollback in Oracle, but Sybase is already
committed.  It's too late.  So what good does it do to have the global
transaction rolled back in a two-phase, container-level transaction?


Ken

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to