This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Spark in Action and have Jean-Georges Perrin on-line!
See this thread for details.
Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Doubt in Remote Interface of Session bean

 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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 Harry
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
    Bookmark Topic Watch Topic
  • New Topic