定义表名称注解:
@Entity
@Table(name="SYS_ROLES", schema="UAWP")
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Role extends StringIdEntity{}
@Column(name = "update_date") ,
@ByteLength(min=1, max=127) // 定义字段大小
@Column(length = 128, nullable = false) 常用的属性有,length=12, 定义该字段有多长,nullable 定义该字段不能为空。
对于布尔型使用的注解形式:
@Type(type = "true_false")
public boolean isMale() {
return male;
}
定义索引的形式:
@Index(name="IDX_ORG_ORDER")
public int getOrder() {
return order;
}
@Transient
public int getUserCount() {
return userCount;
}
时间的注解形式:
@Temporal(TemporalType.TIMESTAMP)
public Date getPublishtime() {
return publishtime;
}