• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

who owns create() ?

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()}
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, it depends on the bean type.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic