0 Replies Latest reply on Aug 10, 2006 7:34 PM by celsogbj

    Association Class mapping with composite primary key

    celsogbj

      Hi,

      I am having a problem trying to mapping an association class with EJB 3 on JBoss.
      I have a class A with a many-to-many mapping with B and an association class C which has an attribute. I implemented using an one-to-many mapping with A and C and another one bettwen C and B. So far so good.

      My problem is that table C has a composite primary key made of a_id and b_id. So, when I implemented C I had to mark the relationships (C with A, C with B) as the primary key (with a primary key class) which resulted on a ?C_PK has no persistent id property? when deployed in JBoss.

      Is there any way to mapping this association class with the primary key being composed by the relationship? Is there any workaround (without using surrogated keys)? Does anybody has any code as example to post? I?ve already searched the achieves and haven?t found anything really helpful.

      Thanks in advance,
      Celso