• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • 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
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic