I am experimenting with Hibernate Envers with great success so far. I have one issue that I am currently puzzled as to how to solve. I have an audited entity that contains a field of another audited entity that I always need to have set to particular revision. For example:
Code:
public class ExampleEntity {
private Long id;
// This would be populated by the audit table at a specific revision.
private OtherEntity entityAtRevision;
}
My desired steps would be as follows:
1. Create a new OtherEntity. Set its data as usual.
2. Crate a new ExampleEnity. Set its data as usual.
3. Set the OtherEntity onto the ExampleEntity.
4. Persist the data.
5. The next time I retrieve the ExampleEntity record from the database, it will have the same exact revision of OtherEntity regardless of how many times ExampleEntity has been modified.
Is there a way to create a join on a particular revision of an audited entity? Thanks!