xinra-oss / review-community

Other
2 stars 0 forks source link

Entity versioning and consensus #58

Open erikhofer opened 7 years ago

erikhofer commented 7 years ago

As partly discussed in #6 every user should be able to edit entities like products. We thus need a versioning system that

Proposal: Whenever an entity of this kind is updated, a diff is created and saved as a "changeset". Also a snapshot of the old version is saved to the database.

The basic entity structure could look like this (optimistic locking not included):

versioning

Considerations:

erikhofer commented 7 years ago

Hibernate Envers can be used to automatically create the "snapshots" (revisions).

Envers can flag properties as changed but these flags can only be used to filter queries. They can't be easily retrieved and Envers can't generate a diff of those properties. ChangeSets could be built using onFlushDirty() of a Hibernate interceptor.