Documentation Archive Developer
PATH  Documentation > WebObjects 4.5 > EOAccess Reference

Table of Contents

EOModelGroup Delegate

Declared in: EOAccess/EOModelGroup.h

Protocol Description

An EOModelGroup object should have a delegate which can influence how it finds and loads models. The EOModelGroup instance delegate can implement the methods below:

In addition to the delegates you assign to EOModelGroup instances, the EOModelGroup class itself can have a delegate. The class delegate implements a single method- defaultModelGroup. For more information, see the EOModelGroup Class Delegate protocol description.

Instance Methods


- (Class)entity:(EOEntity *)entity classForObjectWithGlobalID:(EOGlobalID *)globalID

Used to fine-tune inheritance. The delegate can use globalID to determine a subclass to be used in place of the one specified in entity.


- (Class)entity:(EOEntity *)entity failedToLookupClassNamed:(NSString *)className

Invoked when the class name specified for entity cannot be found at run-time. The delegate can take action (such as loading a bundle) to provide entity with a class corresponding to className. If the delegate cannot provide anything, or if there is no delegate, EOGenericRecord is used.


- (EORelationship *)entity:(EOEntity *)entity relationshipForRow:(NSDictionary *)row relationship:(EORelationship *)relationship

Invoked when relationships are instantiated for a newly fetched object. The delegate can use the information in row to determine which entity the target enterprise object should be associated with, and replace the relationship appropriately.


- (EOModel *)modelGroup:(EOModelGroup *)group entityNamed:(NSString *)name

If implemented by the delegate, this method should search the group for the entity named name and return the entity's EOModel. Return nil if name is not an entity in group.


- (EOEntity *)relationship:(EORelationship *)relationship failedToLookupDestinationNamed:(NSString *)entityName

Invoked when loading relationship and the destination entityName specified in the model file cannot be found in the model group. This most often occurs when a model references entities in another model file that can't be found. If the delegate doesn't implement this method, an exception is raised. If the delegate does implement this method, the method's return value is set as the destination entity. if the delegate returns nil, the destination entity is set to nil.


- (EOEntity *)subEntityForEntity:(EOEntity *)entity primaryKey:(NSDictionary *)primaryKey isFinal:(BOOL *)flag

Allows the delegate to fine-tune inheritance by indicating from which sub-entity an object should be fetched based on its primaryKey. The entity returned must be a sub-entity of entity. If the delegate knows that the object should be fetched from the returned entity and not one of its sub-entities, it should set flag to YES.

Table of Contents