-
1. Re: Get created revision id back
veitg Jun 7, 2013 8:32 AM (in response to veitg)Ok, I guess I've found what I've been looking for:
<T> T
getCurrentRevision(Class<T> revisionEntityClass, boolean persist)
mentioned in:
http://www.warski.org/blog/2012/07/generational-caching-and-envers/
But that means I have to create/implement a revision entity before I can access the revision? Or can I simply use:
DefaultRevisionEntity
http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch15.html#envers-revisionlog
So after I persist() my entites via EntityManager, I call the above method with getCurrentRevision(DefaultRevisionEntity.class, false) and I can
get the created revisionId from the returned object?
What about the RevisionListener. If it gets invoked, does the revision entity passed to it already contain the current revision or will it be set later by Envers?
This isn't quite clear in the docs.
-
2. Re: Get created revision id back
adamw Jun 17, 2013 10:07 AM (in response to veitg)You can use the DefaultRevisionEntity.
In the revision listener, the id won't be yet available.
Adam