Which is better way to create a historical of data in MySQL database ?
I have a table of Project, Task, Activity and Phase, and every time when update some data, need to create a historical for each change. In fact, I was created a ProjectManager to manager the Project, Task, Activity and Phase. Because I have these links:
One Project is composed by many Task, Task is composed by many Activity and Activity is composed by many Phase.
So, I don't know if create, for exemple, a Historical_Phase,a Historical_Activity, Historical_Task and Historical_Projet is the better way for my problem ?
Or a ProjetMediator_Historical is better?
I never worked with this, anyone can help me, please ?
See the ProjectMediator relashionships code in below :
public class ProjetMediator implements Serializable {
private static final long serialVersionUID = 1L;
public static final String FIND_PROJECT_BY_ID_PROJECTMEDIATOR = "ProjetMediator.findProjetMediatorByIdProjet";
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
@JoinColumn(name="id_projet")
private Projet projet;
@ManyToMany( targetEntity=Tache.class, fetch=FetchType.LAZY )
private List<Tache> taches;
@ManyToMany( targetEntity=Activite.class, fetch=FetchType.LAZY )
private List<Activite> activites;
@ManyToMany( targetEntity=Phase.class, fetch=FetchType.LAZY )
private List<Phase> phases;
//get and sets
}
Thank you.