-
1. Re: Thoughts on revision Meta-data
genman Apr 30, 2008 3:07 AM (in response to genman)To clarify: The user of Envers should have to capture the meta data as part of the transaction and do the insert. So Envers isn't directly involved with this meta data insert except in setting the revision details on this meta data field.
One alternative thought I had was that the meta-data entity "UserChange" (as an example) would be updated in every revision and the find would instead go through VersionsReader instead. Then you wouldn't need to introduce @Revision and @RevisionDate.
Anyway, with whatever approach is made, it should be well documented and used in examples. -
2. Re: Thoughts on revision Meta-data
adamw Apr 30, 2008 5:35 AM (in response to genman)Hello,
a very good idea :)
If I understand correctly, it the user would want to persist additional information with each revision (such as: what user modified the data), he would have to create an entity, to which the revision number (obligatorily) and revision date (optionally) would be injected, when the revision is created; the fields would be discovered by marking them as @RevisionNumber and @RevisionDate.
Additionally, he would be able to specify (by a configuration property) a class, which would fill out the rest of the fields. For example - get a Seam Identity component, and set the appropriate user name.
To get the revision data, he would then be able to use:
VersionsReader.getRevisionData(CustomData.class, revisionNumber);
Is that what you meant? :)
--
Adam -
3. Re: Thoughts on revision Meta-data
genman May 1, 2008 3:20 PM (in response to genman)You have pretty much the idea.
Though I am sort of split on either having the meta-data go into its own table (easier to use with SQL/EntityManager) OR update an existing row and Envars would have to be used to track the latter. The update probably makes less sense.
Somebody on "theserverside" was discussing wanting to store all revisions of data in the same table rather than have a separate table to store the revisions and I suppose if you could store revisions either way, then the meta-data could be stored either way as well. (And then I suppose what you could do with @RevisionNumber is actually populate it when you're storing data in the same table.)
I'm not sure about how effective the callback/configured class might be. In some deployments, like if you use Spring or Microcontainer, it's actually easier to pass an instance variable rather than have the configuration refer to a class that's created at start-up. Consider also using annotations and interfaces as well for configuring the callback.
So working through a few examples (e.g. use Envars in Seam) will make it clear the approach you'd use. -
4. Re: Thoughts on revision Meta-data
adamw May 6, 2008 9:00 AM (in response to genman)Hello,
see here:
http://www.jboss.org/envers/revision_log.html
I don't quite understand what do you mean by "passing an instance variable"? How would that look like? So far I've implemented it with a callback.
--
Adam