cancel
Showing results for 
Search instead for 
Did you mean: 

Compound PK and Relationships

Former Member
0 Kudos

Hello,

I've got a problem in my persistent.xml or storage.xml files when deploying my Ear Application. The message explains me that "the number of foreign keys are not the same of primary keys in a many to many relationship".

I've got this message since I defined compound PK on my EJBs. Then, the relationships definition in persistent.xml file is different than having simple PK.

Attributes that are part of the PK are not designed as PK in this file (is it normal ?), and the column definitions for the relationship are not proposed except when this is a simple PK . Is-it all normal ?

But what can explain my problem when deploying ?

Thanks a lot for your explainations.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Re-Hello,

It seems that the attributes composing my PK are not tagged as Primary Key in the persistent.xml file which is not normal.

How can I correct that, knowong that I tried to modify directly the xml code but this is a generated file and my corrections are deleted after regeneration.

Thanks,

Former Member
0 Kudos

Okay,

I found my mistake, it was because I derived all my PK classes by a personnal class which was ObjectPK to factorise methods common to all PK Classes.

It's certainely an introspection problem.

When you add "extends myClass" after "public class myClassPK" it doesn't retrieve the attribute who composed the PK and doesn't attribute them the type Primary Key in the persistent.xml file.