系统生成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))