0

I've got basic Envers working, and I understand how to get something like the name of the calling User into the Revision Entity, since that's effective static data. But how do I add a comment created dynamically by the user for a given revision?

I suppose I can find some way by subclassing some of the listeners and/or classes used by the listeners (or just implementing their interfaces), but if anyone out there has done this already I'd really appreciate an example.

TIA.

Michael
  • 1,351
  • 1
  • 11
  • 25

1 Answers1

1

You write you know how to set some name of the user committing the transaction. I guess therefore you know about the IRevisionListener interface - there you can modify you revision entity before it is saved.

Depending on what host/client/process you run your application on, you need to set the "comment" in some suitable scope. Assuming you're using web app, you can eg set the comment on some HttpContext item and get this value in your IRevisionListener.

Roger
  • 1,944
  • 1
  • 11
  • 17
  • You're correct, and I did understand about implementing IRevisionListener, but I didn't like the fact that the listeners in the examples had to reach out to some framework to get the data. In the end, I didn't find a better way than to just make Comment a static member of the listener class, set it in my application and then copy it into the revision info in the listener. – Michael Oct 24 '15 at 20:53