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

Doubt in Remote Interface of Session bean

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per the EJB 3.0 specifications, the business interface methods need not throw RemoteException in their declaration. But is it mandatory when we explicitly extend the Remote interface in the declaration?? Something like...


When I explicitly say Remote in the Remote Interface definition, is it mandatory that the business methods defined have a throws clause in their declaration?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jothi Shankar Kumar wrote:
When I explicitly say Remote in the Remote Interface definition, is it mandatory that the business methods defined have a throws clause in their declaration?



@Remote == (EJB3.0) remote business interface. Which means that it's a simple POJI and you need not throw RemoteException.

On the other hand if it's a EJB2.x remote component interface, then the method is expected to throw the RemoteException.

For the difference between EJB2.x remote (component) interface and EJB3 remote (business) interface, see this discusssion
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But if you see the source code that I have posted above, the interface is marked with the Remote annotation and as well as extends the Remote interface. The EJB 3 in Action book says that if the interface extends the Remote Interface, then the business methods declared in the interface should throw a RemoteException. I could not beleive this. Can you explain in this front.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jothi Shankar Kumar wrote: The EJB 3 in Action book says that if the interface extends the Remote Interface, then the business methods declared in the interface should throw a RemoteException.



Can you post that exact quote from the book (and also any source code example it shows)? I believe that it's referring to the remote (component) interface and not the remote (business) interface.
 
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This is the code from EJb3 in Action.
I'm assuming that from when you said:

@Remote==EJB3.0


That this will make extending java.rmi.Remote redundant and it will not be necessary to include the "throws RemoteException" clause in the methods.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic