How to properly create composite primary keys – MYSQL
I would use a composite (multi-column) key. This way you can have t1ID and t2ID as foreign keys pointing to their respective tables as well.
I would use a composite (multi-column) key. This way you can have t1ID and t2ID as foreign keys pointing to their respective tables as well.
To map a composite key, you can use the EmbeddedId or the IdClass annotations. I know this question is not strictly about JPA but the rules defined by the specification also applies. So here they are: 2.1.4 Primary Keys and Entity Identity … A composite primary key must correspond to either a single persistent field or property or to a … Read more