I'd say that your Derived class doesn't just become an entity simply because it extends from BaseClass. The Derived class must be annotated with several annotations before it will work properly in the persistence framework as desired, so why should auditing be any different? I think what we first need to decide is foremost what makes the most sense with respect toward consistency. If we assume that super classes can be annotated but those annotations are only activated based on the state of the root entity of that hierarchy, this allows for providing some default auditing behavior that transitively is enabled if and only if the subclass implementation elects to be audited. Similarly, this same configuration permits audited subclass implementations to disable or modify super class auditing behavior if they so choose using audit overrides. Whether an entity extends a @MappedSuperclass or another @Entity, how we gather, interpret, and operate on audited metadata should be consistent. To me this closes the potential usage error gap because there is no gray area on whether it works this or that way based on certain entity hierarchy configurations. As I asked in
HHH-6331 In Progress , please feel free to provide any feedback on this. If we decide to make any changes for this, I'd prefer them in 6.0 or this may need to wait for 7.0 just given the nature of the backward compatibility concerns this could introduce. But presently I'm inclined to view this as working as intended and that subclass entities should be explicitly annotated. |