Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Remote Interface of Session bean

 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • 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?
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • 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: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • 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
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • 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.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic