I've tried to implement that in ejb3. I had some problem with some specific cases such as array.
Moreover, with this approach I was quite anxious with the impact on the performance of my application.
I stopped to look at that ... but I'm still interesting with that subject.
Other approach may be to use DB trigger but that's DB specific and problem is to get the user that perform the change.
I have not thought about the array scenario...I would imagine that if it is in a relation with another table/entity and both marked for History, it would somehow handle both scenarios.
I know the previous 'Audit' implementation and the 'History' implementation from hibernate both follow a logging approach of just what has changed. I was looking for a more detailed 'History' so that you could get the state of the data during a specific time.
*particularly useful for applications with, say, Jboss Rules and testing retroactive changes.
*Although logging is more efficient space-wise, researching the 'state' of the data during a specific time is more processor and labor efficient if captured in its full state. However, if a mechism was in place to retrieve the entire entity state from just the logged changes, that would be wonderful.
I would be interested in feedback and comments.
not very interesting example:
Address clientId|street|city|state|zip|timestamp 32|44 roy drive apt 2|bumsville|ZZ|99999|apr 06 AddressHistory autoId|clientId|street|city|state|zip|timestamp 1|32|345 summerville road|bumsville|ZZ|99999|jan 04 2|32|44 roy drive apt 1|bumsville|ZZ|99999|feb 06