@DbForeignKey
We can use @DbForeignKey
to control the foreign key DDL that
is generated by ebeean.
noConstraint = true
In the following example noConstraint = true
is used
such that no foreign key constraint is generated.
@ManyToOne
@DbForeignKey(noConstraint = true)
Customer customer;
onDelete/onUpdate ConstraintMode
We can specify ConstraintMode
for onDelete
or onUpdate
.
The ConstraintMode
can be one of RESTRICT, SET_NULL, SET_DEFAULT, or CASCADE
.
@ManyToOne
@DbForeignKey(onDelete=ConstraintMode.CASCADE)
Address address;