Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to target specific Envers revision in entity relationship to @Audited entity?

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?

like image 301
Michal Avatar asked Oct 24 '25 20:10

Michal


1 Answers

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.

like image 122
Naros Avatar answered Oct 27 '25 20:10

Naros



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!