• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Another Tricky Mock Exam Question

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, this time I have a mock exam question concerned with Exceptions.
The debate I have is with the interface hierarchy quoted in the question:

If a remote client in a transaction context invokes a business method on a bean with container-managed transaction (the business method has transaction attribute as either Required, Mandatory, and Supports) and the bean throws a non-application exception, the transaction is marked for rollback. The client then receives javax.transaction.TransactionRolledbackException (subclass of java.rmi.RemoteException) which indicates that the transaction has definitely been marked for rollback.

Whats the problem? Well HFEJB quotes TransactionRolledbackException as deriving from javax.ejb NOT javax.transaction. Which is correct?
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can assure you that the HFEJB is wrong w.r.t this. It's javax.transaction.TrasnsactionRequiredException and javax.transaction.TransactionRolledbackException. Only the local counterparts are in the javax.ejb package. The spec is clear on this. This is mentioned in the "Unconfirmed errata" of the book. Recommend you to have a look at both the confirmed and unconfirmed errata
 
Gareth Llewellyn
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So its...

Remote checked Exceptions:
(subclasses of java.rmi.RemoteException)
javax.transaction.TransactionRolledbackException
javax.transaction.TransactionRequiredException

Local unchecked Exceptions:
(subclasses of javax.ejb.EJBException)
javax.ejb.TransactionRolledbackLocalException
javax.ejb.TransactionRequiredLocalException
[ November 17, 2005: Message edited by: Gareth Llewellyn ]
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope, as I already said, the local exceptions are all from the javax.ejb package.

java.rmi.RemoteException
java.rmi.NoSuchObjectException
javax.transaction.TransactionRequiredException
javax.transaction.TransactionRolledbackException

javax.ejb.EJBException
javax.ejb.NoSuchObjectLocalException
javax.ejb.NoSuchEntityException
javax.ejb.TransactionRequiredLocalException
javax.ejb.TransactionRolledbackLocalException

The only mistakes in HFEJB are the package for TransactionRequiredException and TransactionRolledbackException
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is mentioned in the
unconfirmed errata.

Please also take a look at the confirmed errata and make necessary updates to your copy of the book.
 
I don't always make ads but when I do they're tiny
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic