@MapsId("clubId") on the association, you’re saying ‘
clubId does not provide its own mapping. Instead, the mapping on this property here should be used to map the
This means that when persisting the entity, Eclipselink will use
Team.club‘s id to populate the
club_id join column, and then, it will use the value of that join column, to populate the Java property
Team.embeddedId.clubId, whenever the entity is fetched/refreshed. Whatever mapping you put on
Team.embeddedId.clubId will be ignored.
The error comes from the fact that Eclipselink does not consider
club_id to be mapped twice. Instead, only the mapping on
Team.club is taken into account. Being the only mapping for a primary key property, it may not be
insertable = false, updatable = false.
The solution is simple:
- If you want
Team.clubto control the value of the
club_idcolumn, drop the
insertable = false, updatable = false
- Conversely, if you want
CLICK HERE to find out more related problems solutions.