• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

When an EJBObject is created

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friends
When the EJBObject is created and bean is assigned to an EJBObject in the Entity bean life cycle.
Ex:
before ejbCreate() method starts executing
OR
after ejbCreate method complete
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

In CMP entity bean, container creates first a bean instance, calls setEntityContext,
calls ejbCreate() on the bean instance and update the database, creates an EJBObject, assign the bean instance to the EJBObject, and call ejbPostCreate()
 
Konda Balabbigari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
herve
Which is true, even i thought the same thing. But in the page number 213 of Richard Monson in the topic "Transitioning from the Pooled state to the Ready State via creation" it states that first EJB object must be created and then bean instance is taken from the instance pool and assigned it to EJB object. Next the ejbCreate() method is executed.
Is this same thing or different for my question.
Thanks herve
Konda...
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...
even I was confused about the same thing bout what Konda said but
my stand on this point is that the lifecycle specified by Herve,
container creates first a bean instance, calls setEntityContext,
calls ejbCreate() on the bean instance......
is basically the transition from 'Does Not exist state' to 'Pooled state'
and what Konda says is transition from 'Pooled state' to 'Ready state' when the bean instance is already created....
Thanx,
Vidya
 
herve attia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

An ejbCreate(), ejbPostCreate() callbacks methods are only called once in the bean's life cycle !!! my answer was referring to these point because you mentioned these callbacks methods.
A EJBbean (entity and stateful session) can go back and forth between the ready state and pooled state (activation/passivation).
The client is not aware about these mechanism . The container uses the ejbPassivate(), ejbActivate(),( + ejbLoad(), ejbStore() if entity bean only ) to synchronise the bean fields.
The client is still referring the same EJBObject after the EJBBean has been passivated !!! it is why container, during activation, takes a EJB Bean from the pool and assigns it to the EJBObject.

 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to people who took the part-1 exam, it is very important to understand EJB life cycle. The following two problems which posted by Srividya may be worth discussing again.
8.A reference to an EJB can be stored by a client for later use by:
a) serializing the EJBObject to disk
b) Adding the object to the server's pooled objects
c) implementing a find for the bean
d) storing the Handle of the EJB for the bean object
10.A developer successfully creating and tests a stateful bean following deployment, intermittent
"NullpointerException" begin to occur, particularly when the server is hardly loaded. What most likely
to related problem.
a) setSessionContext
b) ejbCreate
c) ejbPassivate
d) beforeCompletion
e) ejbLoad
 
That is a really big piece of pie for such a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic