This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
my question is : the standard method 'create' belongs to which interface or class?i know that the container implements it by : Class.newInstance("myBean.class").
when is the actual create() method that instantiates ejbObject called?at the time the application server boots up?if so,then whenever the client calls a create() (parameterized/empty) on home interface, there actually may not be any actual instantiation occuring, in fact just the ejbCreate method is being called on an existing free-to-use instance of ejbObject in the instance pool.am i right?
the client executes the following statement: remote=home.create()
if this is a stateful session bean,the container will look for an instance in the pool,if it finds one,it does not call create(),instead it sets its session context,then it calls bean's ejbCreate() for initialization. am i right?should a stateless session bean have ejbCreate()?what is the actual flow of execution?
it depends on the bean type. yeah. but also on the vendor, how the creation actually takes place.
i-Ok, Using JNDI get the reference of an EJBHome Object. (it might even be instantiated while you call the lookup. or already have been instantiated by the appln server at startup) Now the Home stub object is also available at the client. ii-the container creates a Bean object or gets an already created bean instance object from a pool-like container.. sets a SessionContext or EntityContext etc. iii-the home at the server also coordinates the EJBRemote I such that an EJBRemote object is instantiated and it is passed a reference to the actual bean object in part ii. iv-the stub of the remote component object is sent to the client. that is all..