aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt in Remote Interface of Session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt in Remote Interface of Session bean" Watch "Doubt in Remote Interface of Session bean" New topic
Author

Doubt in Remote Interface of Session bean

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9504
    
    2

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?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10263
    
168

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


[My Blog] [JavaRanch Journal]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9504
    
    2

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

Joined: Jul 20, 2005
Posts: 10263
    
168

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

Joined: Nov 09, 2008
Posts: 598



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.


===>SCJP 1.5(72%)<===
==>SCWCD1.5(76%)<===
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Doubt in Remote Interface of Session bean