On Thu, 20 Apr 2000, Durgaprasad Swaminathan wrote:
> Hi,
>
> Is a setting of a TX_REQUIRES_NEW transactional attribute same as setting up
> a nested transaction?
No.
>
> In case of TX_REQUIRES_NEW, the original transactional thread is suspended (
> assuming that there was a txn to start with) and a new tx thread is started.
> Does this mean that commit or rollback in the new tx would not affect the
> original tx in any way?
Yes.
Well, it's possible that the new transaction could make
modifications to the database that are subsequently read by the original
transaction: consider the following
original new
begin transaction
do stuff
invoke bean with TX_REQUIRES_NEW
(suspend)
begin transaction
update t1
set attribute1=X
where 1=1
commit
(resume)
select *
from t1
where attribute1=X
commit
The select in the original transaction would see the changes made by the
new transaction.
But I _think_ you were asking about the commit itself; in that case, the
answer is no; the two transactions have no knowledge of each other, and no
special relationship.
> If that is so, how is that different from a nested
> txn?
It's different because, if the original TX (i.e. the one that was
suspended in order to handle the new TX) rolls back, it does not roll back
the new transaction. In a nested transaction, the subtransaction would be
rolled back.
>
> Also, does the setting of TX_REQUIRES_NEW need the underlying resource
> (database) to support this functionality?
I don't see why it should. (Not that I've built an EJB server, mind you,
but it seems to me that it would be relatively straightforward to deal
with this).
============================================================================
Tom Valesky -- [EMAIL PROTECTED] -- http://www.patriot.net/users/tvalesky
===========================================================================
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".