我想在更新/创建状态后立即录制事件。现在我正在使用JPA,AbstractAuditEvent,IDiffEvent事件来生成事件,我可以成功地记录完整的实体信息,例如Case创建事件和案例更新事件但是想要记录案例状态更改事件和仅审计状态列信息分别如何做我做到了。
@Entity(name = "Case")
@EntityListeners(EntityLifecycleListener.class)
public class Case{
@Id
@Column(name = "ID", updatable = false, nullable = false)
@GeneratedValue(generator = "CASE_ID_SEQ")
Long id;
@Column(name = "NAME", unique = false, updatable = true, nullable = false)
private String name;
@Column(name = "NUMBER", unique = true, updatable = false, nullable = false)
private String number;
@Column(name = "STATUS", unique = false, updatable = true, nullable = false)
String status;
@Column(name = "UPDATED_BY", updatable = true, nullable = true)
private String updatedBy;
@Column(name = "UPDATE_DATE", updatable = true, nullable = true)
private LocalDateTime updateDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public LocalDateTime getUpdateDate() {
return updateDate;
}
public void setUpdateDate(LocalDateTime updateDate) {
this.updateDate = updateDate;
}
}