"Jonathan K. Weedon" wrote:
>
> Vlada,
>
> If we look at the EJB specification, it states:
>
> "9.4.7.1 Primary key that maps to a single field in the entity bean class
>
> "The Bean Provider uses the <primkey-field> element of the deployment
> descriptor to specify the container-managed field of the entity bean
> class that contains the primary key. The field's type must be the
> primary key type.
>
> "9.4.7.2 Primary key that maps to multiple fields in the entity bean class
>
> "<etc.>"
>
> I read this as follows:
>
> "If I have a primary key with a single field, use the <primkey-field>
> mechanism, if not, don't."
>
> This, to me, indicates that using a FooPK to contain a single "int"
> or "Integer" is invalid. (Maybe not illegal, but certainly not
> the correct way to do things: e.g., deprecated.) If this is not
> the intent of the spec., I would suggest rewording it to indicate
> that there are actually two ways to map a primary key with a single
> field.
I think you are confusing the matter of the bean class containing one
field which is the primary key with the matter of a primary key class
containing one field.
Even with 9.4.7.1, the primary key class may have more than one field.
Section 9.4.7.1 is only supposing that there is a single field in the
bean class which has the same type as the primary key.
> Also, what of my suggestion to permit "int" as a primary key type.
> As noted previously, this is a very reasonable PK type, due to
> it's inherent non-nullness.
>
> -jkw
>
> Vlada Matena wrote:
> >
> > The primary key class MyPK defined below is legal in EJB 1.1. However,
> > the "value" field must be defined as "public" in the class.
> >
> > Vlada
> >
> > ----- Original Message -----
> > From: "Evan Ireland" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, April 25, 2000 3:25 PM
> > Subject: Re: EJB spec does not permit numbers as primary keys
> >
> > > "Jonathan K. Weedon" wrote:
> > > >
> > > > c) Primary Key wrapper classes for single field primary
> > > > keys are deprecated in EJB 1.1. This precludes using a
> > > > class FooPK as a primary key type.
> > >
> > > If this is deprecated (although I can see no evidence of it myself) then it
> > > is a big mistake.
> > >
> > > I suspect that it is not deprecated. I would recommend the following pattern
> > > for numeric primary keys:
> > >
> > > public class MyPK
> > > {
> > > int value;
> > >
> > > MyPK() { ... }
> > >
> > > // hashCode and equals ...
> > > }
> > >
> > > This is preferable to using java.lang.Integer as a primary key type as it gives
> > > you better type safety (you can't accidentally pass an AccountKey where a
> > > CustomerKey is expected).
> > >
> > > <vendor>
> > > We also permit entity components to have non-valuetype primary keys in our
> > > product, but the mechanism is proprietary and so we leave it undocumented.
> > > </vendor>
> > > ________________________________________________________________________________
> > >
> > > 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".
> > >
> > >
> >
> > ===========================================================================
> > 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".
--
________________________________________________________________________________
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".