Mapping of composite primary keys and foreign keys with shared columns with JPA/Hibernate
问题 I've spent a while trying to figure following JPA/Hibernate mapping with composite primary keys and foreign keys (which share 2 of 3 columns), but no joy so far :(. The sample tables follow (yellow key columns comprise PK, blue key columns comprise FK): And so far, I came with the following mapping (which kind of works - it reads data from the database, but can't write any new Party-AdditionalMessage associations because of the updatable=false, insertable-false): ...other imports... import