This class provides an example of a ManyToOne mapping. The media copy owns
the relationship to the media. Therefore the foreign key to media is within
the media copy database table.
This class has an unrelated technical issue worth mentioning.
Everything would have worked out fine if we created a simple primary key
field for the media copy and a separate foreign key to the media. Instead,
we pretended to encounter a composite primary key where one of the values
doubled as the foreign key to the media.
MediaCopy (pk=MEDIACOPY_MID + COPYNO)
MEDIACOPY_MID (fk to Media.MEDIA_ID)
COPYNO
...
Media (pk=MEDIA_ID)
MEDIA_ID
...
The MediaCopy now has two uses for the MEDIACOPY_MID column. One as a primary
key (part of a compound primary key) and the other as the foreign key to the Media.
We need to make sure the provider preserves the semantics of the primary key while
reusing it from the foreign key.
This implementation will use the JPA 1.0 technique of mapping both the
primary and foreign key properties to the same column and then mark the
foreign key as READ-ONLY using the insertable and updatable properties
of the @Column.