#1228 - Add support to not generate FK Constraint when @JoinColumn(foreignKey=@ForeignKey(ConstraintMode.NO_CONSTRAINT))

This commit is contained in:
Rob Bygrave
2018-02-19 22:45:47 +13:00
parent 183d079b58
commit 2be3099d55
4 changed files with 91 additions and 0 deletions
@@ -30,6 +30,24 @@ public class TestForeignKeyModes extends BaseTestCase {
}
@Test
public void noneViaJoin() {
DfkOne one = new DfkOne("one2");
Ebean.save(one);
DfkNoneViaJoin none = new DfkNoneViaJoin("none2", one);
Ebean.save(none);
// fails unless there is no Foreign key ...
Ebean.delete(one);
DfkNoneViaJoin found = Ebean.find(DfkNoneViaJoin.class, none.getId());
assertThat(found).isNotNull();
// we still reference one ... even though it does not exist anymore
assertThat(found.getOne()).isNotNull();
}
@Test
public void setNullOnDelete() {