to which you can add various Envers-query restrictions. See the docs and javadocs for more info. Is that what you need?
I think that query will return all the entities - even those that were not changed in that particular revision.
Lets say i run an update that sets a particular flag for 10 users in my users table. And that is recorded as revision 25.
What i need is a way to get only those users that were updated as part of revision 25.
will return *all* users that existed at that point - even ones that were not updated.
ah yes, you are right.
You could creating a query (revisions-of-entity even) and adding a restriction on the revision number, as if it was a normal property (so: AuditEntity.property("REV").eq(25)). This should work, I think. (replace "REV" with however you've named your revision number property/column)
Thanks for the reply. Actually what you wrote didn't work exactly but it gave me an idea and this gave me the result I wanted:
Assuming User is an audited entity:
List<User> users= (List<User>) reader.createQuery() .forRevisionsOfEntity(User.class, true, true) .add(AuditEntity.revisionNumber().eq(25)) .getResultList();
The query above returns only users that were changed as part of revision 25.
Another way that also worked but seems a little uglier:
List<User> users= (List<User>)reader.createQuery() .forEntitiesAtRevision(User.class, 25) .add(AuditEntity.revisionNumber().eq(25)) .getResultList();