Amit,

perhaps I might have a go at explaining it from a different viewpoint than
others....

in ejbActivate you basically do lookups of any _instance_specific_things_
(as opposed to non-instance specific lookups that should occur in
setEntityContext).  The reason this method isn't called in the create cycle
is that those instance specific things would be looked up as part of the
create method.

hth

cheers
dim

----- Original Message -----
From: "Krishnan Subramanian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 03, 2002 12:43 AM
Subject: Re: corected question on ejbActivate()


> Amit,
>
> The ejbActivate() is not called when the ejbCreate() is called.
> I'd suggest you refer to the EJB spec (either 1.1 or 2.0) which
> enumerates the life-cycle of entity beans in some detail.
>
> I could send across a document that enumerates the behavior of
> entity beans when running under Borland Enterprise Server if you're
> interested. This should hopefully give you some idea, but you
> need to check up on how things work with your vendor.
>
> On a related note, I do not see why you seem to want to trigger the
> ejbActivate() of an entity bean - which is a Container callback
> method and not a method triggered programmatically by a bean
> developer.
>
> -krish
>
> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Amit Kumar
> Sent: Friday, August 02, 2002 3:46 PM
> To: [EMAIL PROTECTED]
> Subject: Re: corected question on ejbActivate()
>
>
> Thank you Krish for the prompt reply
> but does this mean ejbPostCreate() is always followed by ejbActivate()
because after all a client can call business method on a bean
> with identity only (I am talking about the business methods in the remote
interface.
>
>
>
> > Amit,
> >
> > You should never invoke Container callback methods from your
> > bean code. If your AppServer supports the Transaction Commit
> > Option C (we do :), then beans in the transactional state
> > (where business methods are executed) will return to the pool
> > at the end of the transaction. For beans to move into the
> > transactional state again from the pool [in Option C], the
> > Container will have to invoke the ejbActivate(), followed by
> > other Container callback methods.
> >
> > ejbActivate() only associates an instance with its primary
> > key - in other words, an identity. And on a similar vein, the
> > ejbPassivate() disassociates an instance with its identity
> > (that is, goes back back to the pool).
> >
> > Note that transaction commit option C is slower than B when
> > your application exhibits locality of reference.
> >
> > -krish
> >
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Amit Kumar
> > Sent: Friday, August 02, 2002 11:29 AM
> > To: [EMAIL PROTECTED]
> > Subject: corected question on ejbActivate()
> >
> >
> > my previous mail contain some typos here is the correct mail
> >
> > In an Entity Bean corresponding to ejbActivate() method please correct
me if my understanding is not correct:
> >
> > A bean after creation goes to pool. If some client calls create then a
bean is picked up from the pool and then its ejbCreate()
> > followed by
> > ejbPostCreate() is called. Now if come business mehtod is invokded it
will be executed. In this way ejbActivate() doesnot get a
> > chance be executed ,so if I
> > want to ensure that the ejbActivate() must have been called before any
business method execution I must call ejbActivate() from
> the
> > ejbPostCreate().
> >
> > Best regards
> > Amit K
> >
> >
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff EJB-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to