- Posted by: sachin kulkarni
- Posted on: August 08 2003 02:11 EDT
I am new to EJB.Can anybody tell me how to call one bean from other? what are the steps for that?
Yes, you can call one bean from another.
The process is similar to call First bean from web layer..
Step Involved are -:
1) Do a JNDI lookup
2) And then invoke methods on the returned Home Object
try doing lookup on net for simple example on EJB...Or else read 'Mastering Enterprise JavaBeans' ***** (5 stars) written by ED Roman...
Free PDF is avaliable on this site :)
To add to the above, if you are using EJB 2.0 you can use a "local reference"
The local reference is a new kind of bean interface that allows beans ***in the same container*** to refer to each other directly, without the network overhead of the remote interface.
A local interface is a standard Java interface that does not inherit from RMI. An enterprise bean can be defined as having a local interface, a remote interface, or both.
For code snippets and an example of what the deployment descriptor looks like visit this site.