Forums Register Login

what implements the Home and Remote interfaces?

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
The actual implementation of the home and the remote interfaces is provided by the application server.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
JBoss or other enterprise application server provides implementation for home and remote interfaces.

Regards,

Ujjwal B Soni

Baroda

Gujarat
+Pie Number of slices to send: Send
 

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.
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 932 times.
Similar Threads
home and remote interfaces
How EJB works?
Home Interface and Remote Interface
caching business delegate
My understanding of EJB working.Kindly correct if iam wrong.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:27:53.