• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity with primary key composed of external foreign keys: best way to map?

 
antonio each
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose you have this situation:


TABLE A:
id_a (pk)
column_a

TABLE B:
id_b (pk)
column_b

TABLE C:
id_c (pk)
column_c



COMPOSITE_TABLE: (Where id_X is foreign key to TABLE_X and the triple composed by id_a,id_b,id_c is primary key of COMPOSITE TABLE)
id_a
id_b
id_c


How to map using JPA2 with hibernate implementation?
Thank you!
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure about Hibernate but in JPA isn't there a @Embeddable annotation that points to a separate class representing your PK?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic