Add TrackedHistoryEntty mapped superclass
We need a class that will allow storing a version of itself for conflict resolution.
@MappedSuperclass
public class TrackedHistoryEntty {
@JsonIgnore
@ElementCollection
public List<String> historyJson;
@PreUpdate
@PrePersist
public void addHistory() {
// serialize this in JSON and add it in the historyJson list
}
public <T extend TrackedHistoryEntty> List<T> getHistory() {
// deserialize the historyJson and return it as a list.
}
}
All entities that are updated by the professors should extend this class:
CoursePreference
JoinedSubject
ProfessorEngagement
SubjectDetails
ExamDefinition