I have different classes of users that are subclasses of an AppUser and want to 
use the preferences structure in ERCoreUserInterface. 
Calling addPreferenceRelationshipToActorEntity on the parent entity doesn't 
create a relationship for child classes. I took part of the call from 
ERCoreBusinessLogic and removed the reverse ("pref->user") relationship so that 
I can call this for all the subclasses I care about. 

Two questions. 
1) Am I aiming a gun at my foot with my finger on the trigger? (i.e. Am I doing 
something profoundly stupid here... don't hold back Chuck)
2) Simple tests work with this, but is there something lurking in my limited 
understanding of the nether regions of EOF going to cause problems?


Here is the lift (without the prefs->user portion of the relationship (because 
that is already created in the first call to 
addPreferenceRelationshipToActorEntity)      



    public void addPreferenceRelationshipToActorEntityOnly(String entityName) {
        
        EOEntity actor = EOModelGroup.defaultGroup().entityNamed(entityName);
        String attributeNameToJoin = (String) 
actor.primaryKeyAttributeNames().lastObject();
        EOEntity preference = 
EOModelGroup.defaultGroup().entityNamed("ERCPreference");

        EOJoin preferencesJoin = new 
EOJoin(actor.attributeNamed(attributeNameToJoin), 
preference.attributeNamed("userID"));
        EORelationship preferencesRelationship = new EORelationship();

        preferencesRelationship.setName("preferences");
        actor.addRelationship(preferencesRelationship);
        preferencesRelationship.addJoin(preferencesJoin);
        preferencesRelationship.setToMany(true);
        preferencesRelationship.setJoinSemantic(EORelationship.InnerJoin);
        
preferencesRelationship.setDeleteRule(EOEntityClassDescription.DeleteRuleCascade);
    }


Larry

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to