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

Home business methods and finder exception

 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 398 of HF the two home business methods are throwing FinderExceptions. Is this a requirement of home business methods? I couldn't find this requirement in the book or the spec.
Thanks.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy -- your home business methods are not required to define a FinderException.
However... if your home business method uses a select method, then that select method can *definitely* throw a FinderException, so you MUST declare a FinderException on your ejbSelect methods.
Always.
But you do *not* have to declare a FinderException on all of your home business methods. Remember, some home business methods may not be doing any kind of query, so a FinderException would not be appropriate.
Now, if your home business method invokes a select method, then since the select method MUST declare a FinderException, that means your bean's home business method MUST either handle or declare the FinderException. You will almost always want to declare it, not catch it. (Or catch it but still declare it for times when you still can't be successful from the catch block). But there is no requirement that your home business method MUST declare the FinderException. In other words, once you get into the bean class, the ONLY rule is that the ejbSelect method MUST declare a FinderException. How you handle that from your home business method is up to you, but virtually always... you will declare a FinderException on your home business method (to reflect the FinderException which can be generated by the ejbSelect method that the Container implements), which means that your home interface must ALWAYS declare that FinderException on the home business method.
This is a good question!
Kathy
 
Right! We're on it! Let's get to work tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic