• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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 listen to Steve. Just read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic