@DbForeignKey
@DbForeignKey
は、Ebeanによって生成される外部キーDDLを制御するために使用できます。
noConstraint = true
次の例では、外部キー制約が生成されないようにnoConstraint = true
が使用されています。
@ManyToOne
@DbForeignKey(noConstraint = true)
Customer customer;
onDelete/onUpdate ConstraintMode
onDelete
またはonUpdate
のConstraintMode
を指定できます。
ConstraintMode
は、RESTRICT、SET_NULL、SET_DEFAULT、CASCADE
のいずれかになります。
@ManyToOne
@DbForeignKey(onDelete=ConstraintMode.CASCADE)
Address address;