• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

must not declare remote exception.

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the HFEJB again it is stated that the home methods must not throw Remote Exceptions can somebody explain me the reasoning behind this please.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although they are *declared* in the remote home and component interfaces your bean code should not throw remote exceptions itself.

Instead, you should throw a javax.ejb.EJBException or (rethrow) a RuntimeException in the case of unrecoverable errors, or else an application exception.
 
Murthy Cherukumilli
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is re-stating my question ... i was asking for a reasonging if any..
 
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 -- in EJB 1.0, you (bean developer) *could* declare (and thus throw) RemoteException from your methods, but this was deprecated with EJB 1.1.

I think the main reason was that RemoteException is really meant as a system exception, not an application exception, and the standard now is to use EJBException as the mechanism for communicating ALL system exceptions to the Container. Which means of course that if you *catch* a RemoteException in your bean methods, you must rethrow it as an EJBException.

Does that help?
-Kathy
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason behind this is that it makes your bean code more open: if you would throw a RemoteException you can't expose the method in a local home/component interface.

If instead you throw a EJBException you can, if the interface is remote the container will wrap your EJBException in a RemoteException.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason behind this is that it makes your bean code more open: if you would throw a RemoteException you can't expose the method in a local home/component interface.

If instead you throw a EJBException you can, if the interface is remote the container will wrap your EJBException in a RemoteException.

Hi Paulus,
When we say home methods, these methods are defined in the interface extending from EJBHome or EJBLocalHome.
How can we have an option of exposing the home methods in local home or remote home?
Pls explain.
Thanks
Shobha
SCJP 1.2, SCWCD
 
Paulus Maessen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shobha,

By home methods I mean the business methods that you can define on the local or remote home interface of entity beans, not the methods on the EJB(Local)Home itself.

These methods are implemented on the component interface of the bean (the ejbHome... methods).

Does this answer your question?
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic