Hi,
Take my domain class for example
public class Person
{
private Integer id;
private String name;
private String address;
private String telephone;
//Accessors here..
}
This is great for storing 1 instance of a given Person
, however, the name
for example would most likely change over time, and I would like to retain any previous values, I may wish to see what addresses this person has lived at over the past 10 years.
What are my options for doing this? This is a Java web app so I could potentially have an AUDIT_LOG
table on my schema, but that doesn't sound a very reliable way of keeping track of these changes
Another thought is to have a PersonFamily
and keep all instances of person, assuming the last item in the List is the most recent, such as..
public class PersonFamily
{
private Integer id;
private List<Person> persons;
//Accessors here...
}
Any suggestions on how I can achieve this? Is there a really clean and simple process I've missed?
Thanks