Yes, something like

   Person entity has primary key PersonPK
   Person entity has personId and name attributes.
   PersonPK has personId attribute.
   PersonPK ejbCreate( String name ) returns a PersonPK with the newly
generated value of personId for this bean.

There seems to be nothing keeping me from having a method on the Person
entity

   setPersonId() which updates the personId attribute within the Person
entity.  Clearly it cannot update the PersonPK object which the container
has associated with this entity bean in memory.

In EJB 1.1 there doesn't seem to be anything, not even a mention in the
spec, that this is undesirable behavior on the part of the bean and also on
the part of the bean developer to allow such a thing.

Cheers

-----Original Message-----
From: José González Gómez [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 4:30 AM
To: [EMAIL PROTECTED]
Subject: Re: EJB 1.1 and change of primary key values


   Jay,

   Correct me if I'm wrong, but I think you are supposing you have some
fields in your entity bean that act as primary key, is this right?

   regards
   Jose

Jay Walters wrote:

> To keep ejb-interest from becoming a ghost town I'll ask a question with I
> am hoping an obvious answer.
>
> In looking at the EJB 1.1 spec I don't see anything that keeps me, a bean
> writer from changing the primary key fields within my entity bean (BMP or
> CMP); there is at least one container that would propagate these changes
to
> a CMP entity bean into the database.
>
> My question is, since the primary key associated with the bean doesn't
> change; and in general we shouldn't be changing the identity of a bean in
> midstream, shouldn't the container or the CMP persistence manager complain
> about this?  Or at the least shouldn't there be something in the spec
about
> not doing this when writing an entity bean?  Otherwise locating the bean
by
> primary key will be sort of a hit or miss thing depending on whether it's
> been re-loaded since the primary key in the bean is updated.
>
> Cheers
> Jay Walters
>
>
===========================================================================
> 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