Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why multiple-entity finders must declare FinderException?

 
Vagner Freitas
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.
 
alzamabar
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic