Hi,

The way I see this is that obtaining the primary key from the bean context
can give you the original key associated with the bean.

If you are never going to update your primary key (ie the instance variable
corresponding to your primary key) then there is not much of a difference
between your instance variable and the key in the context.

But if you allow the primary key value to be changed then your 'ejbStore'
would need to use the primary key stored in the context to perform the
update back to the underlying datasource.

So if you need to obtain the original PK associated with the bean use the
one obtained from the context and if your instance variable corresponding to
PK will never be modified then you can use it directly.

Regards,

Durgaprasad

>
>I have a BMP bean that stores, as one of it's instance variables, it's
>primary key (String personID) . Now, if I need to access that key from one
>of the beans methods, I have one of two ways of accessing it:
>
>ps.setString(1, this.personId);
>
>or
>
>ps.setString(1, this.entityContext.getPrimaryKey() );
>
>What is the reasoning behind using one over the other?
>
>Thanks in advance.
>
>Dave
>
>===========================================================================
>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".
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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