There is no difference between how a regular java class calls an ejb method and how one ejb calls a method on another ejb. In all cases where ejb methods are called, you do the jndi lookup for the ejb home and then call business methods on the home or get a reference to an EJBObject from the home and call methods on it.
Originally posted by Anthony Watson: There is no difference between how a regular java class calls an ejb method and how one ejb calls a method on another ejb. In all cases where ejb methods are called, you do the jndi lookup for the ejb home and then call business methods on the home or get a reference to an EJBObject from the home and call methods on it.
EJB's home interface does not define any business methods. The home interface defines the ejb creation & life-cycles methods. The ejb's remote/local interface is where the business methods are defined. If you want to call a business method of the ejb, you have to get reference to the remote/local interface of the ejb.
To the OP: You may also want to consider doing PortableRemoteObject.narrow() on the home interface returned by the jndi lookup.
Ever Existing, Ever Conscious, Ever-new Bliss
Joined: Sep 25, 2003
You're misinformed, Sadanand Murthy. Entity beans have home business methods.
If business method's are written in home interface, than what will you write in remote / local interface? I believe home interface is use to write EJB life cycle method (create, find, destroy, select etc.)
I'll even say why to have business method in Entity Bean first of all. Won't it be better to have business methods defined in Session Bean?
Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
An enterprise Bean's remote home interface defines the methods that allow a remote client to create, find, and remove EJB objects, as well as home business methods that are not specific to a bean instance
So, you are correct Anthony, I was misinformed. Can you give me an instance of a business method in a home interface that you have created/used? I've never had to do this (I haven't written many entity ejbs). And I can't think of any scenario where I'd need to.