Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Why multiple-entity finders must declare FinderException?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • 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
  • 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.

    Bookmark Topic Watch Topic
  • New Topic