• 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
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question about exception

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a question about EJB exception:
Which one of the following statements regarding the client view of exceptions received from an enterprise bean invocation is correct?
1. The client can safely continue the transaction by retrying the operation if an application exception is received.
2. The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.
3. The client can safely continue the transaction by retrying the operation if a non-application exception is received.
4. A local client cannot continue a transaction if javax.transaction.TransactionRolledbackLocalException is received.
5. A remote client cannot continue a transaction if javax.transaction.TransactionRolledbackException is received.
The provided answer is 5 only, but I think 2 and 4 are also correct, any idea about this?
Thanks.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you.
Sunil
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- Question 2 is confusing; what does the "safely" really mean in this case? I would bet that 2 is correct anyway (if the client is EJB, use getRollbackOnly() and if not, use UserTransaction.getStatus()).
- Question 4 is correct in my opinion. How is it supposed to differ from question 5?

Originally posted by Li Xin:
Here is a question about EJB exception:
Which one of the following statements regarding the client view of exceptions received from an enterprise bean invocation is correct?
1. The client can safely continue the transaction by retrying the operation if an application exception is received.
2. The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.
3. The client can safely continue the transaction by retrying the operation if a non-application exception is received.
4. A local client cannot continue a transaction if javax.transaction.TransactionRolledbackLocalException is received.
5. A remote client cannot continue a transaction if javax.transaction.TransactionRolledbackException is received.
The provided answer is 5 only, but I think 2 and 4 are also correct, any idea about this?
Thanks.

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
4 in incorrect because local client receivs javax.ejb.TransactinRolledBackExcepiton not the one in javax.transaction pacage.
1) is wrong becuase you don't know if the transaction is rolled back
2) is wrong becuase if don't have a way to know if it is rolled back if it is containers started the transaction and the bean make decision in this code.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic