How to make Composite Primary Key Using Two Foreign key?
0
I have Three table in which one table is using the foreign key of other two table to make the composite primary key. Now i am using the @Embeddable but as both the key are the foreign key, How i will create the composite primary key now in the Entity. CREATE TABLE table1 (table1id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (table1id)); table2 CREATE TABLE table2 (table2id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (table2id)); table3 CREATE TABLE table3 ( table1id INT NOT NULL, table2id INT NOT NULL, PRIMARY KEY (table1id, table2id), FOREIGN KEY (table1id) REFERENCES table1 (table1id), FOREIGN KEY (table2id) REFERENCES table2 (table2id) ); How to convert this table into an Hibenate Entity. @Entity @Table(name="table3") class Table1 { @Id long tab...