Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Composite key of foreign keys in M:M table

 
Luigi Smith
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use the O/R mapper tool in WSAD 5.1 to generate ejbs for several tables. I have a M:M relationship between two tables that leverage a typical joiner table, but in this joiner table I have a column for additional information about the relationship. If it wasn't for the latter, I usually just create a M:M relationship between two ejbs, but in this case, I need to implement the joiner table in ejb because I need to store this additional column.

The problem is I have the joiner table with two foreign keys (one each for the participating joined tables) that together represent a composite primary key (per a key constraint), and the O/R mapper tool complains that I don't have a primary key for this joiner table. Does anyone know how I can overcome this issue without creating an artificial key in this table? I am using DB2 8.1.

TIA!
 
Luigi Smith
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silly rabbit...it helps to refresh the db schema in WSAD once you create the composite key (of the 2 FKs) in DB2. Lessons learned: Always create the composite key before attempting to gen EJBs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic