]
Gail Badner reassigned HHH-5228:
--------------------------------
Assignee: Adam Warski
In Envers, retrieve only the most recent revision for all entities of
a particular type
---------------------------------------------------------------------------------------
Key: HHH-5228
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5228
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Affects Versions: 3.3.2
Environment: any
Reporter: Edwin Tellman
Assignee: Adam Warski
Priority: Minor
I would like to retrieve the most recent version of everything that has changed since a
specified revision. This is useful for keeping one application synchronized with another.
One system polls the other and the second system provides the current state of things
that have changed recently.
This query fetches everything that has changed since the specified revision:
AuditQuery query = auditReader.createQuery()
.forRevisionsOfEntity(entityClass, false, true)
.add(AuditEntity.revisionNumber().gt(revision))
If I add a maximize restriction on the revision number, I get a single item which changed
at the highest revision number, which isn't what I'm looking for.
You could find the right data in SQL or HQL by grouping by ID and then selecting the
maximum revision from each group.
And, of course, I can use the above query and then filter out the older items from the
result in Java, which is what I'm doing now.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: