Hi
I agree with what Justin just said. Just wanted to add a little to #3:
The EntityContext object persists between entity bean method calls, but
the state of that object keeps on changing. Since this object comes from
a Vendor implemented class, which in turn implements the EntityContext
interface, the implementation is dynamic and changes as the bean
instance is assigned to an EJBObject for service. The situation is
similar to when you obtain a Enumeration from a Vector, and after that
add another object to the Vector: the Enumeration will contain a
reference to the new object also.

Please comment.

Regards

Sanjeev

-----Original Message-----
From: Justin Couch [mailto:[EMAIL PROTECTED]] 
Sent: Friday, November 09, 2001 1:14 AM
To: [EMAIL PROTECTED]
Subject: Re: EJBObject-EntityCOntext-Entity instance

On Thu, 8 Nov 2001, Kenneth D. Litwak wrote:

>   1.  Is there a one to one to one relationship during a method call
between an
> EJBObject, an EntityContext object and an entity bean instance?


>   2.  How often is the setEntityContext method called?  Every time a
bean comes
> out of the free pool into active memory?  When the EJBObject is
created?

According to the EJB lifecycle, the context methods get called exactly
once
in the life of a bean. This is called after the constructor and just as
the
bean is being placed into the pool. Therefore you are required to keep a
reference to the EntityContext in order to use it later on.

>   3.  As a follown to #2 then, does the EntityCont3xt object persist
between
> entity bean method calls?

Yes.

>   4.  If there's a one to one relationship between the EJBObject, the
> EntityContext and the bean instance, and since EJBObject has its own
> getPrimaryKey() method, whywaste time doing context.getPrimaryKey()

How do you acquire an instance of EJBObject? Inside your implementation
class, you don't directly have access to your own EJBObject. The only
way you can do
 that is through the context interface. The biggest difference here is
that, if say during the ejbLoad() method you grabbed the EJBObject and
held a reference
to it, then wen't through the passivate/activate cycle the primary key
returned by EJBObject may be different to that returned by the entity
context. ie You
particular instance may now represent a different piece of data.

>  5.  What is _stored_ in the EntityContext object?

We don't know and don't care. EntityContext could be implemented as a
bunch of
callbacks to the container, or it could contain a bunch of variables.
Either
way, you should not care about it.

--
Justin Couch                         http://www.vlc.com.au/~justin/
Freelance Java Consultant                  http://www.yumetech.com/
Author, Java 3D FAQ Maintainer                  http://www.j3d.org/
-------------------------------------------------------------------
"Look through the lens, and the light breaks down into many lights.
 Turn it or move it, and a new set of arrangements appears... is it
 a single light or many lights, lights that one must know how to
 distinguish, recognise and appreciate? Is it one light with many
 frames or one frame for many lights?"      -Subcomandante Marcos
-------------------------------------------------------------------

========================================================================
===
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