Hi Shanthi
Here are the answers to your questions
Q)
can container call bean class newInstance() method from the home interface? Ans. No, the
EJB specs do not permit you to call the
newInstance().
We need to call the create method on the home interface as the container creates the Object of the home interface and when you call the create method on the home interface the container intercepts your request. It creates an EJBObject. This EJB object is not just an instance of your bean class but it also has the logic for the various services which you have requested for from your container.
If you directly want to use the newInstance method() on the bean class you will have to write all the logic for transaction managment, caching etc, and thus you will loose the purpose of using EJB's. These are services provided by you EJB container and you therefore skip coding for these services when writing your bean code.
I hope this has answered your 3rd question also.
Q)
whats purpose of setSessionContext() method and what will it return?? Ans. setters as such do not reurn anything. setSessionContext() will associate you bean with a session context. You can use this context to know about the beans current transactional state, its security state etc.
I hope this clears most of your doubts.
----
Ankur