We track any action in the system so we use @EntityListeners(AuditListener.class) on entities that listen for any action.
code snippet:
public class AuditListener {
@Autowired
private AuditRepository auditRepo;
@PrePersist
public void preSave(Object object) {
// save audit to database
}
}
so what is the best to use @PrePersist or @PostPersist?