I have two audited entities, A and B. Entity A holds a collection of entity B (annotated as One-to-many relationship). When inserting a new instance of A into the database, all rows of A and B are at the same revision (let's say revision 1). Then, there is an update on A which only affect the instances of entity B. So after the update, the entity A is still at revision 1, whereas the entities of B are at revision 2 (including a MOD entry in the audit table). In Revision 3, the entity A is deleted. Because the collection of entity B is annotated with @Cascade, the entities B belonging to A are deleted as well.
Given this scenario, how to I create an audit query with Envers that gets an instance of entity A with the updated entities B of revision 2? When I query for all revisions of entity A, I either get the deleted entity of A which holds no entities of B (revision 3), or I get A of revision 1 which holds B entities of revision 1, too.
Using Hibernate 3.6, if that helps.