我看了不少类似的问题,如: http://community.jboss.org/message/580407#580407 ,但还没有找到一个解决办法。
一个活动有许多OCCURENCES,当发生难度创建activity_occurence_AUD表与0(创建)修订正确更新。
然而,当一个一次出现除去activity_occurence_AUD表未填充了2(删除)修正。
活动实体:
@Entity
@Table(name = "activity")
@Audited
public class Activity implements Serializable {
private static final long serialVersionUID = 1L;
public static final int[] VALID_PRIORITIES = { 0, 1, 2, 3 };
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id", nullable = false)
private Long id;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "activity")
private List<ActivityOccurrence> activityOccurrenceList;
....
}
ActivityOccurence Entity:
@Entity
@Table(name = "activity_occurrence")
@Audited
public class ActivityOccurrence implements Comparable<ActivityOccurrence>, Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id", nullable = false)
private Long id;
@JoinColumn(name = "activity_id", referencedColumnName = "id", nullable = false)
@ManyToOne(optional = false)
private Activity activity;
....
}
Hibernate属性:
<entry key="hibernate.ejb.event.post-insert"
value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" />
<entry key="hibernate.ejb.event.post-update"
value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" />
<entry key="hibernate.ejb.event.post-delete"
value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" />
<entry key="hibernate.ejb.event.pre-collection-update"
value="org.hibernate.envers.event.AuditEventListener" />
<entry key="hibernate.ejb.event.pre-collection-remove"
value="org.hibernate.envers.event.AuditEventListener" />
<entry key="hibernate.ejb.event.post-collection-recreate"
value="org.hibernate.envers.event.AuditEventListener" />
任何帮助将非常感激。
很奇怪的是,更新工作,但删除没有。
让我知道如果我可以提供任何更多的信息。