On Fri, 8 Dec 2000, Maddison, David wrote:
> jBoss will then use the hashCode (hence the need to implement the hasCode()
> method), as the primary key, and will create a database column to hold it.
>
> When you call findByPrimaryKey and pass in the PersonPK, jBoss will call the
> hashCode method and search for a record in the database with it's primary
> key set to this hashcode.  If it gets more than one record back, (it is a
> hashcode, not a unique id after all), then it will call the equals method on
> each of the returned records primary keys to find the match, hence the need
> to implement the equals method.

        Ummm... Where are you getting this from?  JBoss does not use the
hashCode as the primary key - and it certainly doesn't create a DB column
for the hashCode.  JBoss uses the fields defined in the primary key object
as the primary key.  That is, if FooPK defines variables A and B, the
primary key is two fields in the DB (A and B) *not* one field (the
hashCode of FooPK) or all three.

        Also, for the record, the primkey-field tag is *only* used for an
Entity bean using Container Managed Persistence where the primary key
consists of exactly one field and there is not a custom PK object. (See
EJB 1.1 ch 16/p 254.)

        It's great to help out new people on the list, but please try not
to sound authoritative unless you're *really sure* you're saying the right
thing!

Aaron



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to