Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOAccess Reference

Table of Contents

EOEditingContext Additions


Category of: EOEditingContext
Declared in: EOAccess/EOUtilities.h




Category Description


EOEditingContext Additions is a collection of convenience methods intended to make common operations with EOF easier. EOEditingContext Additions is a category on EOEditingContext provided in EOAccess.






Method Types


Creating new objects
- createAndInsertInstanceOfEntityNamed:
Fetching multiple objects
- objectsForEntityNamed:
- objectsForEntityNamed:qualifierFormat:
- objectsMatchingValue:forKey:entityNamed:
- objectsMatchingValues:entityNamed:
- objectsOfClass:
- objectsWithFetchSpecificationNamed:entityNamed:bindings:
Fetching single objects
- objectForEntityNamed:qualifierFormat:
- objectMatchingValue:forKey:entityNamed:
- objectMatchingValues:entityNamed:
- objectWithFetchSpecificationNamed:entityNamed:bindings:
- objectWithPrimaryKey:entityNamed:
- objectWithPrimaryKeyValue:entityNamed:
Fetching raw rows
- executeStoredProcedureNamed:arguments:
- objectFromRawRow:entityNamed:
- rawRowsForEntityNamed:qualifierFormat:
- rawRowsMatchingValue:forKey:entityNamed:
- rawRowsMatchingValues:entityNamed:
- rawRowsWithSQL:modelNamed:
- rawRowsWithStoredProcedureNamed:arguments:
Accessing the EOF stack
- connectWithModelNamed:connectionDictionaryOverrides:
- databaseContextForModelNamed:
Accessing object data
- destinationKeyForSourceObject:relationshipNamed:
- localInstanceOfObject:
- localInstancesOfObjects:
- primaryKeyForObject:
Accessing model information
- entityForClass:
- entityForObject:
- entityNamed:
- modelGroup


Instance Methods



connectWithModelNamed:connectionDictionaryOverrides:

- (void)connectWithModelNamed:(NSString *)modelName connectionDictionaryOverrides:(NSDictionary *)overrides

Connects to the database using the connection information in the specified model and the provided overrides dictionary. This method facilitates per-session database logins in WebObjects applications. Typically, you'd put a login name and password in the overrides dictionary and otherwise use the values in the model's connection dictionary. Raises an exception if the connection failed.

createAndInsertInstanceOfEntityNamed:

- (id)createAndInsertInstanceOfEntityNamed:(NSString *)entityName

Creates a new enterprise object for the specified entity, inserts it into the receiver, and returns the new object.

databaseContextForModelNamed:

- (EODatabaseContext *)databaseContextForModelNamed:(NSString *)modelName

Returns the database context used to service the specified model.

destinationKeyForSourceObject:relationshipNamed:

- (NSDictionary *)destinationKeyForSourceObject:(id)object relationshipNamed:(NSString *)relationshipName

Returns the foreign key for the rows at the destination entity of the specified relationship. As an example, given entities Department and Employee with a relationship called "department" joining Department.ID and Employee.deptID, invoking this method on a Department object with ID equal to 5 returns a dictionary with a value of 5 for the deptID key.

See Also: - primaryKeyForObject:



entityForClass:

- (EOEntity *)entityForClass:(Class)classObject

Returns the entity associated with the specified class. Raises an exception if the specified entity can't be found or if more than one entity is associated with the class.

See Also: - entityForObject:, - entityNamed:, - objectsOfClass:



entityForObject:

- (EOEntity *)entityForObject:(id)object

Returns the entity associated with the provided enterprise object. Raises an exception if the specified entity can't be found.

See Also: - entityForClass:, - entityNamed:



entityNamed:

- (EOEntity *)entityNamed:(NSString *)entityName

Returns the entity with the specified name. Raises an exception if the specified entity can't be found.

See Also: - entityForClass:, - entityForObject:



executeStoredProcedureNamed:arguments:

- (NSDictionary *)executeStoredProcedureNamed:(NSString *)storedProcedureName arguments:(NSDictionary *)arguments

Executes the specified stored procedure with the provided arguments. Returns the stored procedure's return values (if any). Use only with stored procedures that don't return results rows.

See Also: - rawRowsWithStoredProcedureNamed:arguments:



localInstanceOfObject:

- (id)localInstanceOfObject:(id)object

Translates the specified enterprise object from another editing context to the specified one.

See Also: - localInstancesOfObjects:



localInstancesOfObjects:

- (NSArray *)localInstancesOfObjects:(NSArray *)objects

Translates the specified enterprise objects from another editing context to the specified one.

See Also: - localInstanceOfObject:



modelGroup

- (EOModelGroup *)modelGroup

Returns the model group associated with the editing context's root object store, an EOObjectStoreCoordinator.

objectFromRawRow:entityNamed:

- (id)objectFromRawRow:(NSDictionary *)row entityNamed:(NSString *)entityName

Fetches and returns the object corresponding to the specified raw row (using EOEditingContext's faultForRawRow:entityNamed:). This method can only be used on raw rows that include the row's primary key.

objectMatchingValue:forKey:entityNamed:

- (id)objectMatchingValue:(id)value forKey:(NSString *)key entityNamed:(NSString *)entityName

Creates an EOKeyValueQualifier with the specified key and value and returns matching enterprise objects. Raises an EOMoreThanOneException unless exactly one object is retrieved.

See Also: - objectMatchingValues:entityNamed:, - objectsMatchingValue:forKey:entityNamed:



objectMatchingValues:entityNamed:

- (id)objectMatchingValues:(NSDictionary *)values entityNamed:(NSString *)entityName

Creates EOKeyValueQualifiers for each key-value pair in the specified dictionary, ANDs these qualifiers together into an EOAndQualifier, and returns matching enterprise objects. Raises an EOMoreThanOneException unless exactly one object is retrieved.

See Also: - objectMatchingValue:forKey:entityNamed:, - objectsMatchingValues:entityNamed:



objectsForEntityNamed:

- (NSArray *)objectsForEntityNamed:(NSString *)entityName

Fetches and returns the enterprise objects associated with the specified entity.

See Also: - objectsForEntityNamed:qualifierFormat:, - objectsMatchingValue:forKey:entityNamed:, - objectsMatchingValues:entityNamed:



objectsMatchingValue:forKey:entityNamed:

- (NSArray *)objectsMatchingValue:(id)value forKey:(NSString *)key entityNamed:(NSString *)entityName

Creates an EOKeyValueQualifier with the specified key and value and returns matching enterprise objects.

See Also: - objectMatchingValue:forKey:entityNamed:, - objectsForEntityNamed:, - objectsMatchingValues:entityNamed:



objectsMatchingValues:entityNamed:

- (NSArray *)objectsMatchingValues:(NSDictionary *)values entityNamed:(NSString *)entityName

Creates EOKeyValueQualifiers for each key-value pair in the specified dictionary, ANDs these qualifiers together into an EOAndQualifier, and returns matching enterprise objects.

See Also: - objectMatchingValues:entityNamed:, - objectsForEntityNamed:, - objectsMatchingValue:forKey:entityNamed:



objectsOfClass:

- (NSArray *)objectsOfClass:(Class)classObject

Fetches and returns the enterprise objects associated with the specified class. Raises an EOMoreThanOneException if more than one entity for the class exists.

See Also: - entityForClass:



objectsWithFetchSpecificationNamed:entityNamed:bindings:

- (NSArray *)objectsWithFetchSpecificationNamed:(NSString *)fetchSpecName entityNamed:(NSString *)entityName bindings:(NSDictionary *)bindings

Fetches and returns the enterprise objects retrieved with the specified fetch specification and bindings.

See Also: - objectWithFetchSpecificationNamed:entityNamed:bindings:



objectsForEntityNamed:qualifierFormat:

- (NSArray *)objectsForEntityNamed:(NSString *)entityName qualifierFormat:(NSString *)format, ...

Creates a qualifier with the provided format string and arguments, and returns matching enterprise objects.

See Also: - objectForEntityNamed:qualifierFormat:, - objectsForEntityNamed:



objectWithFetchSpecificationNamed:entityNamed:bindings:

- (id)objectWithFetchSpecificationNamed:(NSString *)fetchSpecName entityNamed:(NSString *)entityName bindings:(NSDictionary *)bindings

Fetches and returns the enterprise objects retrieved with the specified fetch specification and bindings. Raises an EOMoreThanOneException unless exactly one object is retrieved.

See Also: - objectsWithFetchSpecificationNamed:entityNamed:bindings:



objectWithPrimaryKey:entityNamed:

- (id)objectWithPrimaryKey:(NSDictionary *)keyDictionary entityNamed:(NSString *)entityName

Fetches and returns the enterprise object identified by the specified primary key dictionary. Raises an EOMoreThanOneException unless exactly one object is retrieved.

See Also: - objectMatchingValue:forKey:entityNamed:, - objectWithPrimaryKeyValue:entityNamed:, - primaryKeyForObject:



objectWithPrimaryKeyValue:entityNamed:

- (id)objectWithPrimaryKeyValue:(id)value entityNamed:(NSString *)entityName

Fetches and returns the enterprise object identified by the specified primary key value. For use only with enterprise objects that have non-compound primary keys. Raises an EOMoreThanOneException unless exactly one object is retrieved.

See Also: - objectsMatchingValues:entityNamed:, - objectWithPrimaryKey:entityNamed:



objectForEntityNamed:qualifierFormat:

- (id)objectForEntityNamed:(NSString *)entityName qualifierFormat:(NSString *)format, ...

Creates a qualifier with the provided format string and arguments, and returns matching enterprise objects. Raises an EOMoreThanOneException unless exactly one object is retrieved.

See Also: - objectsForEntityNamed:qualifierFormat:, - rawRowsForEntityNamed:qualifierFormat:



primaryKeyForObject:

- (NSDictionary *)primaryKeyForObject:(id)object

Returns the primary key dictionary for the specified enterprise object.

See Also: - objectWithPrimaryKey:entityNamed:, - objectWithPrimaryKeyValue:entityNamed:



rawRowsWithSQL:modelNamed:

- (NSArray *)rawRowsWithSQL:(NSString *)sqlString modelNamed:(NSString *)modelName

Evaluates the specified SQL and returns the resulting raw rows.

See Also: - rawRowsForEntityNamed:qualifierFormat:, - rawRowsWithStoredProcedureNamed:arguments:



rawRowsWithStoredProcedureNamed:arguments:

- (NSArray *)rawRowsWithStoredProcedureNamed:(NSString *)storedProcedureName arguments:(NSDictionary *)arguments

Executes the specified stored procedure with the provided arguments and returns the resulting raw rows.

See Also: - rawRowsWithSQL:modelNamed:



rawRowsMatchingValue:forKey:entityNamed:

- (NSArray *)rawRowsMatchingValue:(id)value forKey:(NSString *)key entityNamed:(NSString *)entityName

Creates an EOKeyValueQualifier with the specified key and value and returns matching raw rows.

See Also: - objectMatchingValue:forKey:entityNamed:, - objectsMatchingValue:forKey:entityNamed:, - rawRowsMatchingValues:entityNamed:



rawRowsMatchingValues:entityNamed:

- (NSArray *)rawRowsMatchingValues:(NSDictionary *)values entityNamed:(NSString *)entityName

Creates EOKeyValueQualifiers for each key-value pair in the specified dictionary, ANDs these qualifiers together into an EOAndQualifier, and returns matching raw rows.

See Also: - objectMatchingValues:entityNamed:, - objectsMatchingValues:entityNamed:, - rawRowsMatchingValue:forKey:entityNamed:



rawRowsForEntityNamed:qualifierFormat:

- (NSArray *)rawRowsForEntityNamed:(NSString *)entityName qualifierFormat:(NSString *)format, ...

Creates a qualifier for the specified entity and with the specified qualifier format and returns matching raw row dictionaries.

See Also: - objectsForEntityNamed:qualifierFormat:, - rawRowsWithSQL:modelNamed:




Table of Contents
The Objective-C source code for EOUtilities is available as an example. On Mac OS X Server systems, see /System/Developer/Examples/EnterpriseObjects/Sources/EOUtilities. On NT, see $NEXT_ROOT\Developer\Examples\EnterpriseObjects\Sources\EOUtilities.