Object parentKeyObj = entity.getProperty(PARENT_KEY_PROPERTY);
if (parentKeyObj != null) {
AbstractClassMetaData parentCmd = sm.getMetaDataManager().getMetaDataForClass(
ammd.getType(), fieldManager.getClassLoaderResolver());
Key parentKey = EntityUtils.getPkAsKey(parentKeyObj, parentCmd, fieldManager.getObjectManager());
entity.removeProperty(PARENT_KEY_PROPERTY);
fieldManager.recreateEntityWithParent(parentKey);
}
}
};