• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



-- 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 !!
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic