• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin

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.
Cowgirl and Author
Posts: 1589
  • 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.
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!
The City calls upon her steadfast protectors. Now for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic