I want to record a event as soon as Status is updated/created. Right now I am using JPA, AbstractAuditEvent, IDiffEvent events for generating events where it I am successfully able to log complete entity information like Case create event and case updated event but want to log case status change event and audit only status column information separately how do I achieve that.
@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;
}
}