| I believe there may be a slight misunderstanding of the current implementation here. The global_with_modified_flag property is meant as a means to force the feature ON for all audited properties, regardless of what configuration you've specified in your @Audited annotations. I believe the documentation is clear about what this means when this is true versus false, but if you disagree we can certainly look at that and try to be clearer. The class-level versus property-level configurations do have a precedence and from what I see, works as intended. If an entity is annotated with @Audited at the class-level, that configuration will be implied on properties that are not annotated with @Audited within that same class. However, should a property be annotated with @Audited, the class-level configuration is ignored and the explicit annotation configuration at the property takes precedence and is used. Lets look at this example entity:
@Entity
@Audited(withModifiedFlag=true)
public class SomeEntity {
@Id
private Integer id;
private String name;
@Audited
private String otherImplicit;
@Audited(withModifiedFlag=false)
private String otherExplicit;
}
The audit table for this entity will contain a single modified flags field for name. None of the other properties will have such a field because (1) we don't track that for identifiers and (2) the properties annotated with @Audited override any class-level configuration (they both imply withModifiedFlag=false because one uses the default implicit value and the other explicitly specifies the flag as false). Now, none of this is to say that a better solution couldn't be realized. The only real downside to the current implementation is that you cannot specify the global configuration as true and then explicitly toggle the feature off for specific classes or audited properties within a class. The only way to accomplish this is to be explicit at all @Audited annotation usage sites and not use the global configuration. Unless I have missed something and you can cite/point me in a specific direction of an example where a bug does exist or the behavior doesn't follow what I've documented here, then I am inclined to mark this issue as an enhancement and we look at ways to improve upon this in a future major release. |