aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes what implements the Home and Remote interfaces? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "what implements the Home and Remote interfaces?" Watch "what implements the Home and Remote interfaces?" New topic
Author

what implements the Home and Remote interfaces?

Ravissant Markandey
Ranch Hand

Joined: Oct 24, 2007
Posts: 41
Hi Everyone, Im an ejb newbie, what i want to know is, where are the home and remote interfaces implemented.
The home interface has a create() method that returns a reference to the remote interface(is it?)
In my project this create method is used in a delegate class to create an object of the remote interface(apparently its the class implementing the home interface)...my question is where is this class??..or once again, where are the home and remote interfaces implemented?

Thanks in advance,
Ravissant
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

The actual implementation of the home and the remote interfaces is provided by the application server.


[My Blog] [JavaRanch Journal]
Ravissant Markandey
Ranch Hand

Joined: Oct 24, 2007
Posts: 41
Thanks so much for the response Jaikiran, well actually in the project im working on, the Business Delegate Design Pattern is being used..so in the businessDelegateImplementation class(which implements the businessDelegate interface), a bean class method is called using a remote interface reference, what i want to know is:
How are we able to access the methods in the bean class with a reference of type remote interface when the bean class DOESNT even implement the remote interface?

Thanks a lot,
Ravissant
Abhinav Srivastava
Ranch Hand

Joined: Nov 19, 2002
Posts: 349

You do not invoke methods on the bean class, rather on the RemoteObject thru the Proxy (Stub). The remote object then delegates your call to the actual bean object.
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
JBoss or other enterprise application server provides implementation for home and remote interfaces.

Regards,

Ujjwal B Soni

Baroda

Gujarat


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Originally posted by Ravissant Markandey:
How are we able to access the methods in the bean class with a reference of type remote interface when the bean class DOESNT even implement the remote interface?



In EJB2.x when you implement a bean class you dont actually include the "implements MyEJBRemoteInterface" in the bean class definition. But, remember that the EJB that you implement are expected to implement the specs, which means that any method that is declared in the remote/local interface has to be present and implemented in the bean definition class. The application server while deploying the EJB will check whether the method that are mentioned in the remote/local interface are also present in the bean implementation class (the ejb-jar.xml will help the server in knowing which remote interface corresponds to which ejb-class). If the server finds that the bean implementation class does not have the methods which have been declared in the remote interface then it throws an exception while deploying.

Furthermore, the proxies (generated by the application server) that are returned to the client (in your case the business delegate) through JNDI lookup, will implement the remote/local interfaces.
 
Consider Paul's rocket mass heater.
 
subject: what implements the Home and Remote interfaces?