// object already associated to another object
fkList.add(testData.getNonPkOIntegerFkList().get(2));
// object not associated yet
fkList.add(testData.getNonPkOIntegerFkList().get(3));
// new object
NonPkOIntegerFk newNonPkOIntegerFk = new NonPkOIntegerFk();
newNonPkOIntegerFk.setName("newNonPkOIntegerFk");
fkList.add(newNonPkOIntegerFk);
OIntegerPkPeer.setAndSaveNonPkOIntegerFks(
oIntegerPk,
fkList);
List<NonPkOIntegerFk> cachedFks
= oIntegerPk.getNonPkOIntegerFks();
assertEquals(4, cachedFks.size());
assertEquals(
testData.getNonPkOIntegerFkList().get(1).getId(),
cachedFks.get(0).getId());
assertEquals(
oIntegerPk.getIntegerColumn(),
cachedFks.get(0).getFk());
assertEquals(
testData.getNonPkOIntegerFkList().get(1).getName(),
cachedFks.get(0).getName());
assertEquals(
testData.getNonPkOIntegerFkList().get(2).getId(),
cachedFks.get(1).getId());
assertEquals(
oIntegerPk.getIntegerColumn(),
cachedFks.get(1).getFk());
assertEquals(
testData.getNonPkOIntegerFkList().get(2).getName(),
cachedFks.get(1).getName());
assertEquals(
testData.getNonPkOIntegerFkList().get(3).getId(),
cachedFks.get(2).getId());
assertEquals(
oIntegerPk.getIntegerColumn(),
cachedFks.get(2).getFk());
assertEquals(
testData.getNonPkOIntegerFkList().get(3).getName(),
cachedFks.get(2).getName());
assertEquals(
newNonPkOIntegerFk.getId(),
cachedFks.get(3).getId());
assertEquals(
oIntegerPk.getIntegerColumn(),
cachedFks.get(3).getFk());
assertEquals(
newNonPkOIntegerFk.getName(),
cachedFks.get(3).getName());
// check database
ForeignKeySchemaData.assertNonPkOIntegerFksInDatabaseEquals(
cachedFks);