Hi,
Good call! Sorry about my blunder; EntityContext has client-contextual
info, hence makes sense to be created only when the client requests for a
specific bean info!
I guess I always associate the PrimaryKey with the EntityContext and not the
EJBObject because all the EJB books I read tell me when I'm in a bean
instance and need the PK, call getEntityContext().getPrimaryKey(). Although
getEJBObject().getPrimaryKey() would return the exact same object, I think
this invocation is more indicative of exactly where the PK resides.
Gene
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
To: [EMAIL PROTECTED]
Sent: 8/29/00 11:18 PM
Subject: Re: Newbie question: How are keys generated?
> When you ejbCreate a new bean, you create the PK object in this method
and
> pass it out in the return; the server container the takes over and
does
the
> "setting". This implementation is vendor-specific, but in general the
> container would
>
> 1) create an EntityContext that refers to the pk
> 2) create an EJBObject that's somehow affiliated to this
EntityContext
> 3) return the EJBObject to you (from EJBHome.create)
A minor clarification for step 1 - the entity context will not get
created
as a result of an ejbCreate. The entity context gets created when the
container creates entity bean instances. When an entity bean instance is
associated with an EJBObject, the EntityContext would get hold of this
EJBObject and the primary key.
so the steps would be
1. create an EJBObject and associate the primary key with this EJBObject
2. At a later time when an entity bean instance is required by this
EJBObject, the container will get a free bean instance and associate the
bean instance and its entity context with the EJBObject
-saurabh
========================================================================
===
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".