明天的明天 永远的永远 未知的一切 我与你一起承担 ??

是非成败转头空 青山依旧在 几度夕阳红 。。。
  博客园  :: 首页  :: 管理

JPA配置实体时 insertable = false, updatable = false

Posted on 2023-08-03 12:52  且行且思  阅读(243)  评论(0编辑  收藏  举报
    @Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss", width = 20)
    @Column(name = "created_time", insertable = false, columnDefinition = "timestamp default current_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    @Generated(GenerationTime.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected Date createdTime;

 

    @Excel(name = "修改时间", format = "yyyy-MM-dd HH:mm:ss", width = 20)
    @Column(name = "updated_time")
    @org.hibernate.annotations.UpdateTimestamp
    @Temporal(TemporalType.TIMESTAMP)
    protected Date updatedTime;