1 Reply Latest reply on Feb 9, 2006 5:10 PM by Emmanuel Bernard

    Composite pk/fk

    Mark James Newbie

      This one is killing me, can't find info on (or figure out on my own) how to do this in ejb3.

      I have an "association plus" entity (normal association entity plus two additional fields, one of which is part of the composite PK) with 2 fk's and 3 pk's - two of which are the fk's. Since this is not a pure ManyToMany I have it designed as 2 ManyToOne.

      I have the composite PK defined as a PK class, no annotations. I have the PK properties defined in the entity class (which is annotated with @IdClass) and they are annotated with @Id. The two PK's that are the FK's are also annotated with @ManyToOne with appropriate @JoinColumns.

      It all seems correct to me, but I am getting

      org.hibernate.MappingException: property not found: (insert PK property name here)

      on one of the pk properties (one of the pk/fk fields).

      Does anyone know of a resource anywhere that explains how to do this somewhat "exotic" mapping in EJB3? Or feel like explaining it here? ;-)

      Many thanks in advance! I hope I was clear enough...

      -Mark

      P.S. Cannot post code as is, but if necessary I can whip up a similar example.