This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

who owns create() ?

 
kriti sharma
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

create()->setSessionContext()->ejbCreate()->businessMethods()->passivate()/activate()->remove(){ejbRemove()}
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're confusing alot of stuff here.

1) "create" is only invoked by the client -- never the container.
2) The time that "ejbCreate" is invoked depends on the bean type.

I'd type further about it, but I don't quite know how without spitting out everything I know about the various beans' lifecycle.
 
kriti sharma
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nathaniel Stoddard:

1) "create" is only invoked by the client -- never the container.


after create is invoked at the client, where does the control go,where is the executable code...the code that runs before ejbCreate?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, it depends on the bean type.
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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..

hope clarifiable?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic