Forums Register Login

Can the client continue after getting the exception ??? and other doubts

+Pie Number of slices to send: Send
Hi,
Please clarify me the below doubt,

1. Client call the method with in the transaction context, bean has rolled back the transaction, now the client gets, TransactionRolledBackException. If the user wants to continue the transaction, can he continue ( Even he may not commit the transaction at the end)

2. From the select statement can i select the more than one cmp field, i.e. "select e.name, e.empno from employee as e"

3. I saw in one of the material, "ONLY message-driven beans can asynchronously receive messages." --> What it means?

Thanks in Advance..
+Pie Number of slices to send: Send
1. Client call the method with in the transaction context, bean has rolled back the transaction, now the client gets, TransactionRolledBackException. If the user wants to continue the transaction, can he continue ( Even he may not commit the transaction at the end)

-- When the client receives it, the transaction has already been rolled back. All the client can do is retry the transaction. i.e., lookup home and re-invoke the method, for example.

3. I saw in one of the material, "ONLY message-driven beans can asynchronously receive messages." --> What it means?

-- This means that a MDB's client need not have to wait till onMessage() method returns. Clients can simply send message and proceed with the processing. You can assume as if you are spawing a thread when you send in a message to a MDB.
[ August 17, 2004: Message edited by: Keerthi P ]
+Pie Number of slices to send: Send



-- When the client receives it, the transaction has already been rolled back. All the client can do is retry the transaction. i.e., re-invoke the method, for example.


By the time the client gets this exception, the container might have discarded the bean instance. So the client won't be able to call the method again !!
+Pie Number of slices to send: Send
Thanks to Giju and Keerthi.

"By the time the client gets this exception, the container might have discarded the bean instance. So the client won't be able to call the method again !! "

Here i didn't say, bean has thrown the exception.
Take the case - there is no exception any where and the beans wants to roll back the transaction, hence he called the method setRollbackOnly(), then the transaction is rolled back and the client get the TransactionRolledBackException(). In this case client can continue with the instance.
Take other case - there is a system exception, then the transction will be rolled back, bean instance will be discarded. Now the client gets, TransactionRolledBackException, in this case client can not continue with the instance, because the instance has been discarded.

If i am wrong, please correct me..
+Pie Number of slices to send: Send
If setRollbackOnly() has been called and the container has to rollback the transaction, it will *NOT* throw TransactionRolledbackException just to indicate the client that the transaction has been *successfully* rolled back.

TransactionRolledbackException will *ONLY* be thrown if for some reason the container cannot COMMIT the transaction in a CMT method running in the context of a transaction.
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 888 times.
Similar Threads
TrasactionRolledbackException
Question from ejbcertificate.com on Exception
Question about exception
application exception
Qn about exceptions from ejbcertificate
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:11:46.