Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA 2.0 - eclipse link composite primary key problem..  RSS feed

Miltos Tereres
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two entities(actually more but it doenst matter)

Exam and Exam_Normals

Its a oneToMany relationship... The problem is that i need a primary key for Exams_Normals PK (Exam_ID Item)
Item should be 1 2 3 4 5 etc....

I cound use an IDENTITY and a ManyToOne relationship at Exam_Normals but that should be like PK(Exam_Normals_ID) and a reference to Exam and an extra collumn
Item to keep an order.. SO 3 collumns

I tried with @IdClass and got errors
Tried @EmbeddedID everything nothing works

Any idea??

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!