1、@Column属性
(1)设置字段属性唯一
@Column(unique=true) private String name;
2、为boolean字段设置默认值false,在表中的值默认为0
//删除位 @Column(nullable = false,columnDefinition="BOOLEAN default false") private boolean deleted;
3、时间戳默认值
@Column(updatable = false,nullable=false,columnDefinition="timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") @Temporal(TemporalType.TIMESTAMP) private Date createdDate;
Done