我有一个经典的继承持久化实体Parent和Child,其中Child扩展Parent.类Parent是抽象的,而Child不是.
我想审核孩子.这个实体在我的控制之下,而Parent则不在.此外,它还有许多其他不需要审计的子类.整个层次结构的继承策略是JOINED.
所以我用@Audited注释了Child,另外还有@AuditOverride(forClass = Parent.class).
我得到的是这个错误:
"org.hibernate.MappingException:实体'Child'被审计,但是它的超类:'Parent'不是."
顺便说一下,我正在使用envers 4.0.1.Final版本.
有谁知道我怎么能做到这一点? 我试图消除@Audited在儿童类,除去@AuditOverride,使用过时auditParents在@Audited注释,但似乎没有任何工作.
这是Parent实体:
@Entity
@Table(name = "parent")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "type")
public class Parent {
public Parent() {
super();
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "base_id", unique = true, nullable = false)
private …Run Code Online (Sandbox Code Playgroud)