key = EntityUtils.extractChildKey(childPC, ec, owned ? datastoreEntity : null);
}
if (owned) {
// Check that we aren't assigning an owned child with different parent
if (!datastoreEntity.getKey().equals(key.getParent())) {
throw new NucleusFatalUserException(GAE_LOCALISER.msg("AppEngine.OwnedChildCannotChangeParent",
key, datastoreEntity.getKey()));
}
}
value = key;
if (!datastoreEntity.hasProperty(propName) || !value.equals(datastoreEntity.getProperty(propName))) {