HHH-7555 - Update documentation to document the new revision information entity query api.

(backport from wip/6.0)
This commit is contained in:
Chris Cranford 2018-02-21 14:14:34 -05:00
parent fea7f348ee
commit 79354bab9f
1 changed files with 25 additions and 0 deletions

View File

@ -1152,6 +1152,31 @@ include::{extrasdir}/envers-querying-entity-relation-nested-join-multiple-restri
----
====
[[envers-querying-revision-entities]]
=== Querying for revision information without loading entities
It may sometimes be useful to load information about revisions to find out who performed specific revisions or
to know what entity names were modified but the change log about the related audited entities isn't needed.
This API allows an efficient way to get the revision information entity log without instantiating the actual
entities themselves.
Here is a simple example:
[source,java]
----
AuditQuery query = getAuditReader().createQuery()
.forRevisionsOfEntity( DefaultRevisionEntity.class, true )
.add( AuditEntity.revisionNumber().between( 1, 25 ) );
----
This query will return all revision information entities for revisions between 1 and 25 including those which are
related to deletions. If deletions are not of interest, you would pass `false` as the second argument.
Note this this query uses the `DefaultRevisionEntity` class type. The class provided will vary depending on the
configuration properties used to configure Envers or if you supply your own revision entity. Typically users who
will use this API will likely be providing a custom revision entity implementation to obtain custom information
being maintained per revision.
[[envers-conditional-auditing]]
=== Conditional auditing