A legacy database contains a join table which links tables table1 and table2, and contains just two foreign keys:
TABLE_ORIG:
table1_id
table2_id
In order to utilize this table using JPA I would need to create a surrogate primary key to the link table. However, the existing table must not be modified at all.
I would like to create another table which would contain also a primary key in addition to the foreign keys:
TABLE_NEW:
id
table1_id
table2_id
All changes to TABLE_ORIG should be reflected in TABLE_NEW, and vice versa.
Is this doable in mysql?