We did that trick and it works well. Thanks! :-)
I'm glad that JPA 2.0 will fix that. It is a really drawback.
Thanks!
Markus
Gordon Yorke schrieb:
> Support for this functionality will be in JPA 2.0. (The details can
> be seen in the early draft
> http://jcp.org/aboutJava/communityprocess/edr/jsr317/index.html ).
>
> In TopLink it is possible to do this as James mentioned but it is also
> possible to get the same functionality in JPA 1.0 by creating an
> attribute in the Entity for the FK/PK field and marking it @Id and as
> updatable=false, insertable=false. Then simply put the @OneToOne
> mapping on the actual relationship. Be sure to set the new attribute
> id value when the MyMasterEntity is set on this Entity. This will
> also provide you with a straight forward mechanism for creating the
> PKClass.
> --Gordon
>
> Markus Karg wrote:
>>
>> We need to have a entity primary key pointing to another entity
>> (typical master-detail construction).
>>
>>
>>
>> Is it possible to do:
>>
>>
>>
>> @Id
>>
>> private MyMasterEntity;
>>
>>
>>
>> ?
>>
>>
>>
>> Also for legacy reasons we need a PK class. Is it possible to have
>> private MyMasterEntity as a field in the PK class, or how to deal
>> with that?
>>
>>
>>
>> Thanks
>>
>> Markus
>>
>>
>>
>> QUIPSY QUALITY GmbH & Co. KG
>>
>> Ein Unternehmen der MES-Gruppe
>>
>> Stuttgarter Strasse 23
>>
>> D-75179 Pforzheim
>>
>> Tel: 07231-9189-52
>>
>> Fax: 07231-9189-59
>>
>> www.quipsy.de <http://www.quipsy.de>
>>
>> karg_at_quipsy.de <mailto:karg_at_quipsy.de>
>>
>> Registergericht Mannheim HRA 701214
>>
>> Geschäftsführer: Nils Schroeder
>>
>>
>>
>> Diese E-Mail enthält persönliche, vertrauliche und vor Weitergabe
>> geschützte Informationen und ist ausschließlich für den vorgesehenen
>> o.g. Empfänger (Adressaten) bestimmt. Falls Sie diese E-Mail
>> versehentlich erhalten haben und nicht der vorgesehene Empfänger
>> sind, bitten wir Sie, die E-Mail und deren Anhänge nicht
>> aufzubewahren, nicht zu vervielfältigen, nicht zu nutzen und nicht
>> weiterzugeben. Bitte informieren Sie uns als Absender über diesen
>> Zustellungsfehler und löschen Sie die E-Mail.
>>
>>
>>
--
http://www.xing.com/go/invita/58469