@NotAudited
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@OneToMany(mappedBy = \"booking\")
@OrderBy(\"bookingOrder\")
private List
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
has only one usage: When you have audited entity owning the relationship to not audited entity and you want info in audit data about the id of not audited entity. Let's say that CustomerBooking
is audited and Hotel class is not audited. You have two choices for Hotel field:@NotAudited
(in which case you will not have info about hotel in historical data at all) or @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
in which case you will have always the latest state of Hotel in audit data.
Note that if Hotel was audited RelationTargetAuditMode.NOT_AUDITED
will just be ignored (you will have historical data for Hotel).
@NotAudited
means "I just don't care for this field in historical data" (it won't be saved, relationship will be null, you won't see it when looking historical data about CustomerBooking
)