Hi Bhupesh:

You asked: Am I correct in assuming that when I obtain a UserTransaction
object (sessionContext.getUserTransaction) in bean B, this should be the
same UserTransaction that is active from bean A? Answer: The transaction is
stateful session A is suspended when stateful session B takes over.

Are you updating multiple data sources in your transaction? A
HeuristicMixedException occurs when some resource managers make the
unilateral decision to commit or rollback after Phase 1 but before Phase II
of the 2-phase commit protocol (i.e., they make a heuristic decision), and
others make the opposite decision, or the decision doesn't match the
decision of the transaction coordinator.

If you are not updating multiple data sources, I wonder if stateful session
bean B is timing out, and that could be causing the HeuristicMixedException.


In either case, timing considerations may be the reason that sometimes you
get the HeuristicMixedException and other times you don't.

It is my understanding that chaining stateful session beans is considered to
be bad practice, precisely because one could time out before the other. Why
do you need to chain stateful session beans? (Anyone out there have opinions
on chaining stateful session beans?)

Laurel

-----Original Message-----
From: Bhupesh Wagjiani [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 31, 2001 4:31 AM
To: [EMAIL PROTECTED]
Subject: Transaction Propogation


All,

I'm after some clarification as to my understanding about how transaction
propogation works.

I have a Stateful session bean (A) with bean managed transactions. This bean
obtains a UserTransaction object (sessionContext.getUserTransaction) and
begins a transaction. It then calls various stateless session beans that
actually insert/update data. These stateless beans have container managed
transactions with a transaction attribute of Requires.

Bean A then makes a call to another Stateful session bean (B). Bean B also
obtains a UserTransaction object (sessionContext.getUserTransaction) and
checks the STATUS. If there is already a transaction active it continues to
call other stateless beans to update/insert records in the same way that
bean A did. It then returns control back to beans A. If there isn't an
active transaction it begins and commits/rollsback locally.

The problem I have is that when I try to commit or rollback in bean A I
sometimes get a javax.transaction.HeuristicMixedException. I'm a little
confused as this problem seems to occur randomly even when using exactly the
same data/sequence of events. When I call userTransaction.getStatus() in
bean B this does return me what I expect (STATUS_ACTIVE) and I do not commit
or rollback from bean B.

Am I correct in assuming that when I obtain a UserTransaction object
(sessionContext.getUserTransaction) in bean B, this should be the same
UserTransaction that is active from bean A?

Could this be a bug in my container or is what I'm trying to do not correct?


regards
Bhupesh Wagjiani

===========================================================================
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".

===========================================================================
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