I want to have versions from the same data entry. In other words, I want to duplicate the entry with another version number.
id - Version will be the primary key.
How should the entity look like? How can I duplicate it with another version?
id Version ColumnA
1 0 Some data
1 1 Some Other data
2 0 Data 2. Entry
2 1 Data
You can make an
Embedded class, which contains your two keys, and then have a reference to that class asEmbeddedIdin yourEntity.You would need the
@EmbeddedIdand@Embeddableannotations.Another way to achieve this task is to use
@IdClassannotation, and place both youridin thatIdClass. Now you can use normal@Idannotation on both the attributes