users@glassfish.java.net

RE: No ID column

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 12 Jun 2007 13:58:05 -0400

Have you mapped the table as an Entity? If you have mapped it as an Entity then you must define a PK. In the case of a join table both FKs should be combined to create a compound PK. Is the relationship a true many to many? Have you considered mapping the join table as a secondary table in the case of one to many relationship?
--Gordon
  -----Original Message-----
  From: Kenneth Clark [mailto:kenneth_at_rabiddog.co.za]
  Sent: Tuesday, June 12, 2007 1:23 PM
  To: users_at_glassfish.dev.java.net
  Subject: No ID column


  I have a many to many table that designates the relationships between two entities and I get the following error:

  It should define either an @Id, @EmbeddedId or an @IdClass. javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b41d-beta2 (04/24/2007))):

   

  The table contains no primary keys as it doesn't require any.

   

  Anyone have any ideas?

   

  Kenneth Clark
  System Architect / Lead Developer

  Rabid Dog Laboratories T
  Putting the art back into development

  tel: +27 11 475 7409
  mobile: +27 82 500 5090
  e-mail: kenneth_at_rabiddog.co.za
  website: http://www.rabiddog.co.za/