As we all know that for calling a method of a different bean from one bean we have to first get the ejbobject and then call the method for calling a entity bean from session bean we first of all create primary key object using primarky key class and then use findByprimaryKey to get the ejb object and subsequently call the method of entity bean can anyone tell me how to do the same procedure if we have to call session bean's method from our current session bean?
SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
I agree with Thomas. The only way I know of to invoke a method on a bean (any type, from anywhere) is to first get a reference to the bean's remote interface, and the only way to do that for a session bean (that I know of), is to lookup the bean's home interface and then invoke the "create" method. For an entity bean -- as you say -- you can use "findByPrimaryKey".
Of-course, that's why (IMO) the EJB 2 spec introduces the local home interface and local remote interface -- so that a session bean can more easily and more quickly get a reference to another bean's remote interface.
Obtain the Initail context and then look up for the Home nad one you obtained the home object then call its create method to ogtain the remote object try the following code and make it suit to your case