mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1228 - Add support to not generate FK Constraint when @JoinColumn(foreignKey=@ForeignKey(ConstraintMode.NO_CONSTRAINT))
This commit is contained in:
@@ -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() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user