This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with TensorFlow and have Chris A. Mattmann on-line!
See this thread for details.
Win a copy of Machine Learning with TensorFlow this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

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

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic