AuditQuery q = auditReader.createQuery().forRevisionsOfEntity(Book.class, true, true) All attributes of a deleted entity except its id are null. When you set it to true, your query will also return deleted entities. The effect of the selectDeletedEntities is pretty obvious. In the following code snippet, I set this parameter to true, and the query returns the entities which were active at the selected revisions. This parameter has no effect when you define a projection for your query. The selectedEntitiesOnly parameter defines if you want to retrieve a list of entities which changed at the selected revisions or if you want to retrieve a list of arrays with an instance of the affected entity, a revision entity, and a RevisionType enum. You can create such a query by calling the forRevisionsOfEntity(Class c, boolean selectedEntitiesOnly, boolean selectDeletedEntities) method as I do in the following code snippet. It allows you to retrieve the revisions in which an entity instance was created, edited or deleted. Let’s have a look at the definition of a vertical query first. As soon as you’ve done that, you can use the API to define your query. With Hibernate Envers, you can use both perspectives to look at your audit information. You just need to tell Envers which perspective you want to use when you define your query. The horizontal perspective looks at a revision and shows you the information stored in your database at that point in time. You can use 2 different perspectives when you look at your audit log. The vertical perspective looks at an entity instance and shows you in which revisions it was created, edited or deleted. License:Open Source License /** SuppressWarnings( / / w w w. Prototype AuditQuery setFirstResult( int firstResult) įrom source file: de.HistoryDAOImpl.java IntroductionIn this page you can find the example usage for AuditQuery setFirstResult.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |