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

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

 
kenny lomax
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • 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...
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • 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.
 
Kenny Lomax
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks
Kenny
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic