jpa注解

作者: ob伞兵 | 来源:发表于2018-03-02 10:08 被阅读0次

系统生成uuid注解配置:

@Id

@GenericGenerator(name ="system-uuid", strategy ="uuid2")

@GeneratedValue(generator ="system-uuid")

@Column(name ="id",length =64)

一对多不产生外键关联关系,重点是foreignKey :

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)

@JoinColumn(name ="project_application_id", foreignKey =@ForeignKey(name ="none", value = ConstraintMode.NO_CONSTRAINT))

非外键关联配置,重点是referencedColumnName 指向关联表的字段

@ManyToOne(fetch = FetchType.LAZY)

@JoinColumn(name ="service_coupons_type", referencedColumnName ="service_coupons_type", foreignKey =@ForeignKey(name ="none", value = ConstraintMode.NO_CONSTRAINT))

相关文章

网友评论

      本文标题:jpa注解

      本文链接:https://www.haomeiwen.com/subject/acwoxftx.html