Kenneth,
If you have an instance variable to save the primary key, you can
set it (by calling context.getPrimaryKey() in ejbPostCreate and ejbActivate
and it should always be valid anywhere else you need it (e.g. ejbLoad,
ejbStore, ejbRemove).
Regarding calling myRemoteObject.getPrimaryKey(), you would
have to use the context.getObject() anyway to get the remote
object reference, so you can't avoid using the context in one
way or another to obtain the key.
Kenneth D. Litwak wrote:
> As I understand it, in methods like ejbLoad() and ejbRemove() it is
> recommended taht context.getPrimaryKey() be called before you attempt to do a
> load or remove in a BMP bean. The reason for this is that the actual bean
> instance performing the operation may not have a valid key field in it in the
> sense taht the data might be from a diferent entity which was not cleared out
> when the bean was passivated back to the free pool. Fine. Here are my
> questions.
>
> 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?
>
> 3. As a follown to #2 then, does the EntityCont3xt object persist between
> entity bean method calls?
>
> 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(), wich I
> presume makes the entity context object call the gePrimaryKey) method of the
> EJBObject, instead of just calling myRemoteObject.getPrimaryKey()? Why waste
> time with the EntityCOntext object? Thanks.
>
> 5. What is _stored_ in the EntityContext object?
>
> Ken
>
> ===========================================================================
> 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".
>
>
>
>
--
_______________________________________________________________________________
Evan Ireland Sybase EAServer Engineering [EMAIL PROTECTED]
Wellington, New Zealand +64 4 934-5856
===========================================================================
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".