2

I need to maintain entity A relationship to certain revision of @Audited entity B, so that the relationship doesn't always point to the latest version (which is the default behaviour).

Is there a framework feature (or recommended solution) for declarative approach to including the revision in the relationship?

Should this be implemented by versioning both sides of the relationship? (But that only shifts the target revision problem to the next entity in chain)

Is this a different pattern to Envers auditing?

Or is this a complete customization?

Michal
  • 2,078
  • 23
  • 36

1 Answers1

2

Envers is a transaction-scoped entity state snapshot auditing framework.

In short this means that any audited entity modified during a transaction will be captured in a snapshot and then stored in the audit tables. This means what you're trying to accomplish is outside the scope of the purpose behind the framework.

It's hard to offer any real suggestions as your comment about shifting the problem sounds as though you may need some form of cascading when an object graph is Entity A -> Entity B -> Entity C -> ... -> Entity n.

If you have more to share in your original post, update it and I can update my answer as well.

Naros
  • 19,928
  • 3
  • 41
  • 71