1
  • Table1 (PK - x)
  • Table2 (PK - y)

Lookup Table (PK - [x, y]), z(additional attribute)

I want to create Entity classes for Table1 and Table2 using JPA. Also, I want my Lookup Table to have some additional attributes. How can I achieve this?

Anurag
  • 43
  • 6
  • 1
    As you have additional attributes, you will need to map a classe for the relationship. Your many to many relationship thus becomes two many to one. – Maurice Perry Sep 17 '19 at 05:39
  • Probably you are trying to achieve something [like this](https://medium.com/@bhagyajayashani/composite-key-handling-using-embeddedid-annotation-in-spring-boot-java-67c29da9d119)? – Mushif Ali Nawaz Sep 17 '19 at 05:56
  • Possible duplicate of [JPA 2.0 many-to-many with extra column](https://stackoverflow.com/questions/23837561/jpa-2-0-many-to-many-with-extra-column) – Alan Hay Sep 17 '19 at 08:13

0 Answers0