How to autogenerate created or modified timestamp field?

后端 未结 8 1416
独厮守ぢ
独厮守ぢ 2020-12-05 03:11

My entity class:

@Entity
@Table(name = \"user\")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
           


        
8条回答
  •  伪装坚强ぢ
    2020-12-05 03:29

    import org.hibernate.annotations.CreationTimestamp;
    import org.hibernate.annotations.UpdateTimestamp;
    
    .
    .
    .
    
    @CreationTimestamp
    private Date created;
    
    @UpdateTimestamp
    private Date modified;
    

提交回复
热议问题