You can, as long as the relationship field is not CMR. You're prohibited
to use CMR in ejbCreate(...), but allowed in ejbPostCreate(...). Since
the fields for the PK must be set in ejbCreate, a CMR relationship field
cannot be part of the PK. If you handle the relationship on your own,
then you can use a FK as part of the PK. In that case, you'd be relying
on the RDBMS to enforce the FK constraint (by the spec, some vendors
might provide it, I know none that does).

HTH,

Juan Pablo Lorandi
Chief Software Architect
Code Foundry Ltd.
[EMAIL PROTECTED]

Barberstown, Straffan, Co. Kildare, Ireland.
Tel: +353-1-6012050  Fax: +353-1-6012051
Mobile: +353-86-2157900
www.codefoundry.com


> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]] On Behalf Of Juan Alvarez
> Sent: Monday, January 20, 2003 10:56 PM
> To: [EMAIL PROTECTED]
> Subject: Primary key composed of foreign key
>
>
> Is possible to have a entity bean with a primary key, formed
> by a foreign key (relationship field)?
>
> --
> Juan Alvarez                                Fluidsignal Group S.A.
> mailto:[EMAIL PROTECTED]        http://www.fluidsignal.com/
> Key fingerprint: 15C4 0986 A174 862A B607 8EEA 934F 8649 07E2 EA40
>
> ==============================================================
> =============
> 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