EOEntity e=EOModelGroup.defaultGroup().entityNamed(from.entityName());
EOEntity e=ERXEOAccessUtilities.entityNamed(from.editingContext(), from.entityName());
    public static void addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to,                                                                                        EOEnterpriseObject from,                                                                                        String keyPath) {        if (from!=null) {            if (keyPath.indexOf('.')!=-1) { // we have a key path                String partialKeyPath=ERXStringUtilities.keyPathWithoutLastProperty(keyPath);                from=(EOEnterpriseObject)from.valueForKeyPath(partialKeyPath);                keyPath=ERXStringUtilities.lastPropertyKeyInKeyPath(keyPath);            }            //if the key is not a keyPath we can check if the key is actually a relationship            EOEntity e=EOModelGroup.defaultGroup().entityNamed(from.entityName());            EORelationship r=e.relationshipNamed(keyPath);            if (r!=null) //if the key correspond to a relationship                from.addObjectToBothSidesOfRelationshipWithKey(to, keyPath);            else                from.takeValueForKeyPath(to,keyPath);        }    }