• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

public Collection findByGenre(String Genre) throws **FinderException**..

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
my 2nd question to the group
I read in HeadFirstEJB that finder methods that return Collections return an empty collection if nothing is found and do not throw a FinderException.
Why then on page 398 is the method

public Collection findByGenre(String Genre) throws FinderException, RemoteException;

declared as throwing as FinderException?

Thanks
Kenny
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have searched in the spec and not able to find clear definition for this, but it is mentioned in both single entity finder as well multi entity finder. Also it is mentioned for the select methods...
 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many reasons that would bring you errors in finding some entities in the database. So any find or select methods have to define finderException.

For example, your given primary key does not have a matching in the table, or you do not have authurization to retrieve that entity, or some other application exception occurs during find process, no matter what, the method will bring up the finderException, because after all, exception happens in the 'find' prcoess of the method.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks
Kenny
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic