My stateless session bean has a number of methods that are marked in the deployment as Requiring a transaction.
Now, when my client call one of those method, if a transaction does not exit, one will be created. I understood that part, but how does the EJB container knows when a transaction has ended?
I can see how the container knows when there is a need to create a new transaction, but how does it know when to commit or when to rollback? I mean, my transaction could involve anywhere between 1 to 10000 method calls...
-
Transactions Woes (4 messages)
- Posted by: Digit Sequence
- Posted on: May 19 2001 16:57 EDT
Threaded Messages (4)
- Transactions Woes by qing yan on May 19 2001 23:45 EDT
- Transactions Woes by Digit Sequence on May 20 2001 03:28 EDT
- Transactions Woes by sanjib ghosh on May 20 2001 12:11 EDT
- Transactions Woes by Richard Kenyon on May 21 2001 05:02 EDT
- Transactions Woes by Digit Sequence on May 20 2001 03:28 EDT
-
Transactions Woes[ Go to top ]
- Posted by: qing yan
- Posted on: May 19 2001 23:45 EDT
- in response to Digit Sequence
When a method marked as transaction "requires" get called,
if the caller hasn't started a transaction, a single method
run will be a transaction, otherwise it will be part of
the existing transaction. -
Transactions Woes[ Go to top ]
- Posted by: Digit Sequence
- Posted on: May 20 2001 03:28 EDT
- in response to qing yan
Yeah, I know that, but when does that transaction that was create automatically end??? As soon as the function exits?
Say bean A has the methods a1,a2,a3,a4. All of the functions require a transaction.
The client calls a1,a2,a3,a4 in that order. Say the client did not create a transaction, when a1 is called, a transaction is created by the container, the question is, when does that transaction gets committed or rollback? As soon as a1 exits ?
-
Transactions Woes[ Go to top ]
- Posted by: sanjib ghosh
- Posted on: May 20 2001 12:11 EDT
- in response to Digit Sequence
that's right. It would commit/rollback as soon as a1 exits. -
Transactions Woes[ Go to top ]
- Posted by: Richard Kenyon
- Posted on: May 21 2001 05:02 EDT
- in response to Digit Sequence
The transaction ends effctively when control is passed back to the client (unless the client has created the transaction). In your case, every call to a method on the EJB will create and commit/rollback a transaction.
If you wanted multiple method calls to be included in one transaction, you could 'wrap' the method calls in a session EJB, or create the transaction on the client.
Cheers,
Rick