Thanks Macus

Maybe a possible solution would be to make a getFK() and setFK() method to
access the relation directly.  Not really the ultimate but it would probably
get around my problem. That is what middlegen seems to do. Maybe that way it
will. Can you see a problem with this? For me, this is not optimal but if it
gets set only in the ejbCreate then it may work. Please send me some
feedback folks.

cheers

Jordan

-----Original Message-----
From: Marcus Brito [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 17 December 2002 12:20 PM
To: Jordan Thomas
Cc: [EMAIL PROTECTED]
Subject: Re: [Xdoclet-user] Compound Primary Key


Jordan Thomas wrote:
> Hi,
>
> How do I create a compound Primary key for my ejb's with XDoclet? I tried
> using the @ejb.pk-field tag on two fields to no avail. Essentially, I want
> to have a relation and an ID form the key.

Ah, the old "FK in PK" problem. This is not a xdoclet fault, but an EJB
fault. You bean must have it's primary key defined by the time
ejbCreate() returns, but relations can't be set in ejbCreate(). That
way, according to the current EJB specification, you can't have foreign
keys as part of your primary key.

This sucks, I know, and most app server vendors know and provide some
proprietary way to circumvent this.

On the XDoclet side, the restrition is that @ejb.pk-field must be used
on a CMP field, and a relation is not a CMP field. That must be why
you're having problems adding your relation to the primary key.

Solutions for your problem? I don't know. We could change the xdoclet
behavior so it now looks for @ejb.pk-field in relations too, but then we
still have the problem with the EJB specification.

--
Pazu



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to