Javax’s PrePersist annotation

  java

the usage scenarios

    private Date lastUpdateAt;

    @PrePersist
    public void recordUpdateTime(){
        lastUpdateAt = new Date();
    }

It can be used to record some service-independent fields when using jpa, such as the last update time, etc.