PrimaryKey expectedPK = getPrimaryKey();
if (expectedPK.size() == 0)
{
if (!actualPKs.isEmpty())
{
throw new WrongPrimaryKeyException(this.toString(), expectedPK.toString(), StringUtils.collectionToString(actualPKs.values()));
}
}
else
{
if (actualPKs.size() != 1 ||
!actualPKs.values().contains(expectedPK))
{
throw new WrongPrimaryKeyException(this.toString(), expectedPK.toString(), StringUtils.collectionToString(actualPKs.values()));
}
}
return true;
}