// object already associated to another object
fkList.add(testData.getNullableOIntegerFkList().get(0));
// object not associated yet
fkList.add(testData.getNullableOIntegerFkList().get(3));
// new object
NullableOIntegerFk newNullableOIntegerFk = new NullableOIntegerFk();
newNullableOIntegerFk.setName("newNullableOIntegerFk");
fkList.add(newNullableOIntegerFk);
OIntegerPkPeer.setAndSaveNullableOIntegerFks(
oIntegerPk,
fkList);
List<NullableOIntegerFk> cachedFks
= oIntegerPk.getNullableOIntegerFks();
assertEquals(4, cachedFks.size());
assertEquals(
testData.getNullableOIntegerFkList().get(1).getId(),
cachedFks.get(0).getId());
assertEquals(
oIntegerPk.getId(),
cachedFks.get(0).getFk());
assertEquals(
testData.getNullableOIntegerFkList().get(1).getName(),
cachedFks.get(0).getName());
assertEquals(
testData.getNullableOIntegerFkList().get(0).getId(),
cachedFks.get(1).getId());
assertEquals(
oIntegerPk.getId(),
cachedFks.get(1).getFk());
assertEquals(
testData.getNullableOIntegerFkList().get(0).getName(),
cachedFks.get(1).getName());
assertEquals(
testData.getNullableOIntegerFkList().get(3).getId(),
cachedFks.get(2).getId());
assertEquals(
oIntegerPk.getId(),
cachedFks.get(2).getFk());
assertEquals(
testData.getNullableOIntegerFkList().get(3).getName(),
cachedFks.get(2).getName());
assertEquals(
newNullableOIntegerFk.getId(),
cachedFks.get(3).getId());
assertEquals(
oIntegerPk.getId(),
cachedFks.get(3).getFk());
assertEquals(
newNullableOIntegerFk.getName(),
cachedFks.get(3).getName());
// check database
ForeignKeySchemaData.assertNullableOIntegerFksInDatabaseEquals(
cachedFks);