1 class
@Entity
@Table(name="GZL_ACTION_DEFINE")
2 property
加在getter方法前,简单值属性也可以不加
getter、setter、is方法会自动映射为column
3 用@Transient
取消当前属性的映射
4
@OneToMany(mappedBy="trans",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
@OrderBy("sortFlag")
@OneToMany
@JoinColumn(name="FK_desctransid")
@OrderBy("sortFlag")
@Id
@Column(name = "id")
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinColumn(name="flowDefineId")
@ForeignKey(name="FK_FD_AD")
5 list必须有排序字段,而且是数字类型
@OrderBy("sortFlag")
6 一个entity有多个集合
@OneToMany
@JoinColumn(name="FK_desctransid")
@IndexColumn(name="sortFlag")
7 单向关联
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinTable(
name="GZL_TCond_DESA",//表名
joinColumns = { @JoinColumn( name="condition_id") },//当前对象的关联id
inverseJoinColumns = @JoinColumn( name="actionDefine_id")//关联表的id
)
@IndexColumn(name="sortFlag")
@Entity
@Table(name="GZL_ACTION_DEFINE")
2 property
加在getter方法前,简单值属性也可以不加
getter、setter、is方法会自动映射为column
3 用@Transient
取消当前属性的映射
4
@OneToMany(mappedBy="trans",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
@OrderBy("sortFlag")
@OneToMany
@JoinColumn(name="FK_desctransid")
@OrderBy("sortFlag")
@Id
@Column(name = "id")
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinColumn(name="flowDefineId")
@ForeignKey(name="FK_FD_AD")
5 list必须有排序字段,而且是数字类型
@OrderBy("sortFlag")
6 一个entity有多个集合
@OneToMany
@JoinColumn(name="FK_desctransid")
@IndexColumn(name="sortFlag")
7 单向关联
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinTable(
name="GZL_TCond_DESA",//表名
joinColumns = { @JoinColumn( name="condition_id") },//当前对象的关联id
inverseJoinColumns = @JoinColumn( name="actionDefine_id")//关联表的id
)
@IndexColumn(name="sortFlag")