• 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
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Why multiple-entity finders must declare FinderException?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

In HFE page 279 bullet 5 she says:
"All finders must declare both a RemoteException and a FinderException".
I wonder why multiple-entity finders must declare FinderException because do not throw an exception if no matching entities are found.

Tanks in advance.
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vagner Freitas:
Hi All,

In HFE page 279 bullet 5 she says:
"All finders must declare both a RemoteException and a FinderException".
I wonder why multiple-entity finders must declare FinderException because do not throw an exception if no matching entities are found.

Tanks in advance.



Because a FinderException can be thrown also for reasons other than the fact that the underlying entities haven't been found.

From EJB Specs 10.5.8.3:




From the client�s perspective, a FinderException (or a subclass of FinderException) indicates
that an application level error occurred during the find(...) operation. Typically, the transaction
has not been marked for rollback because of the FinderException.

The Container throws the FinderException (or subclass of FinderException) from the implementation
of a finder or select method to indicate an application-level error in the finder or select
method. The Container should not, typically, mark the transaction for rollback before throwing the
FinderException.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic