| While Envers could potentially manually call the JPA post-load callback, the concern I have with that is that the post-load callback is pretty clear about the Persistence Context and managed state requirement for the entity in question. As I said before, the entity instance Envers returns isn't managed, so it isn't in the Persistence Context nor can it be. Obviously, one solution is to have whatever code is integrating with Envers to manually invoke your post-load method directly as a step you do after the detached instances have been fetched. I realize that its less than ideal, but it accomplishes the task none-the-less. Perhaps a solution in the middle is to introduce a new annotation, @AuditPostLoad. This avoids confusion on the persistence context requirements that the JPA annotation has and allows the listener callback to be very specific. You could just include the Envers annotation along side that of the JPA one for a given method and allow both scenarios to invoke the method. Anyone have any specific thoughts on the new @AuditPostLoad annotation? |