Each method requires an editing context into which the objects
should be fetched; this editing context is passed as the first argument
to each method in EOUtilities.
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. |
Method Types
- Creating new objects
- createAndInsertInstance
- Fetching multiple objects
- objectsForEntityNamed
- objectsWithQualifierFormat
- objectsMatchingKeyAndValue
- objectsMatchingValues
- objectsOfClass
- objectsWithFetchSpecificationAndBindings
- Fetching single objects
- objectWithQualifierFormat
- objectMatchingKeyAndValue
- objectMatchingValues
- objectWithFetchSpecificationAndBindings
- objectWithPrimaryKey
- objectWithPrimaryKeyValue
- Fetching raw rows
- executeStoredProcedureNamed
- objectFromRawRow
- rawRowsWithQualifierFormat
- rawRowsMatchingKeyAndValue
- rawRowsMatchingValues
- rawRowsForSQL
- rawRowsForStoredProcedureNamed
- Accessing the EOF stack
- connectWithModelNamed
- databaseContextForModelNamed
- Accessing object data
- destinationKeyForSourceObject
- localInstanceOfObject
- localInstancesOfObjects
- primaryKeyForObject
- Accessing model information
- entityForClass
- entityForObject
- entityNamed
- modelGroup
Instance Methods
public static void connectWithModelNamed(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String modelName,
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. Throws an exception if the connection failed.
public static com.apple.yellow.eocontrol.EOEnterpriseObject createAndInsertInstance(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName)
Creates a new enterprise object for the specified
entity, inserts it into editingContext,
and returns the new object.
public static EODatabaseContext databaseContextForModelNamed(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String modelName)
Returns the database context used to service
the specified model.
public static NSDictionary destinationKeyForSourceObject(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
com.apple.yellow.eocontrol.EOEnterpriseObject object,
String 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
public static EOEntity entityForClass(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
Class classObject)
Returns the entity associated with the specified
class. Throws 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
public static EOEntity entityForObject(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
com.apple.yellow.eocontrol.EOEnterpriseObject object)
Returns the entity associated with the provided
enterprise object. Throws an exception if the specified entity can't
be found.See Also: entityForClass, entityNamed
public static EOEntity entityNamed(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName)
Returns the entity with the specified name. Throws an
exception if the specified entity can't be found.See
Also: entityForClass, entityForObject
public static NSDictionary executeStoredProcedureNamed(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String storedProcedureName,
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: rawRowsForStoredProcedureNamed
public static com.apple.yellow.eocontrol.EOEnterpriseObject localInstanceOfObject(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
com.apple.yellow.eocontrol.EOEnterpriseObject object)
Translates the specified enterprise object from
another editing context to the specified one.See
Also: localInstancesOfObjects
public static NSArray localInstancesOfObjects(
com.apple.yellow.eocontrol.EOEditingContext,
editingContext,
NSArray objects)
Translates the specified enterprise objects
from another editing context to the specified one.See
Also: localInstanceOfObject
public static EOModelGroup modelGroup(com.apple.yellow.eocontrol.EOEditingContext editingContext)
Returns the model group associated with the
editing context's root object store, an EOObjectStoreCoordinator.
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectFromRawRow(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
NSDictionary row)
Fetches and returns the object corresponding
to the specified raw row (using EOEditingContext's faultForRawRow).
This method can only be used on raw rows that include the row's
primary key.
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectMatchingKeyAndValue(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String key,
Object value)
Creates an EOKeyValueQualifier with the specified
key and value and returns matching enterprise objects. Throws an
exception unless
exactly one object is retrieved.See Also: objectMatchingValues, objectsMatchingKeyAndValue
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectMatchingValues(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
NSDictionary values)
Creates EOKeyValueQualifiers for each key-value
pair in the specified dictionary, ANDs these qualifiers together
into an EOAndQualifier, and returns matching enterprise objects. Throws an
exception unless
exactly one object is retrieved.See Also: objectMatchingKeyAndValue, objectsMatchingValues
public static NSArray objectsForEntityNamed(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName)
Fetches and returns the enterprise objects associated
with the specified entity.See Also: objectsWithQualifierFormat, objectsMatchingKeyAndValue, objectsMatchingValues
public static NSArray objectsMatchingKeyAndValue(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String key,
Object value)
Creates an EOKeyValueQualifier with the specified
key and value and returns matching enterprise objects.See
Also: objectMatchingKeyAndValue, objectsForEntityNamed, objectsMatchingValues
public static NSArray objectsMatchingValues(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
NSDictionary values)
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, objectsForEntityNamed, objectsMatchingKeyAndValue
public static NSArray objectsOfClass(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
Class classObject)
Fetches and returns the enterprise objects associated
with the specified class. Throws an
exception if more
than one entity for the class exists.See
Also: entityForClass
public static NSArray objectsWithFetchSpecificationAndBindings(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String fetchSpecName,
NSDictionary bindings)
Fetches and returns the enterprise objects retrieved
with the specified fetch specification and bindings.See
Also: objectWithFetchSpecificationAndBindings
public static NSArray objectsWithQualifierFormat(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String format,
NSArray arguments)
Creates a qualifier with the provided format
string and arguments, and returns matching enterprise objects.See
Also: objectWithQualifierFormat, objectsForEntityNamed
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectWithFetchSpecificationAndBindings(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String fetchSpecName,
NSDictionary bindings)
Fetches and returns the enterprise objects retrieved
with the specified fetch specification and bindings. Throws an
exception unless
exactly one object is retrieved.See Also: objectsWithFetchSpecificationAndBindings
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectWithPrimaryKey(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
NSDictionary keyDictionary)
Fetches and returns the enterprise object identified
by the specified primary key dictionary. Throws an
exception unless
exactly one object is retrieved.See Also: objectMatchingKeyAndValue, objectWithPrimaryKeyValue, primaryKeyForObject
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectWithPrimaryKeyValue(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
Object value)
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. Throws an
exception unless
exactly one object is retrieved.See Also: objectsMatchingValues, objectWithPrimaryKey
public static com.apple.yellow.eocontrol.EOEnterpriseObject objectWithQualifierFormat(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String format,
NSArray arguments)
Creates a qualifier with the provided format
string and arguments, and returns matching enterprise objects. Throws an
exception unless
exactly one object is retrieved.See Also: objectsWithQualifierFormat, rawRowsWithQualifierFormat
public static NSDictionary primaryKeyForObject(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
com.apple.yellow.eocontrol.EOEnterpriseObject object)
Returns the primary key dictionary for the specified
enterprise object.See Also: objectWithPrimaryKey, objectWithPrimaryKeyValue
public static NSArray rawRowsForSQL(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String modelName,
String sqlString)
Evaluates the specified SQL and returns the
resulting raw rows.See Also: rawRowsWithQualifierFormat, rawRowsForStoredProcedureNamed
public static NSArray rawRowsForStoredProcedureNamed(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String storedProcedureName,
NSDictionary arguments)
Executes the specified stored procedure with
the provided arguments and returns the resulting raw rows.See
Also: rawRowsForSQL
public static NSArray rawRowsMatchingKeyAndValue(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String key,
Object value)
Creates an EOKeyValueQualifier with the specified
key and value and returns matching raw rows.See
Also: objectMatchingKeyAndValue, objectsMatchingKeyAndValue, rawRowsMatchingValues
public static NSArray rawRowsMatchingValues(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
NSDictionary values)
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, objectsMatchingValues, rawRowsMatchingKeyAndValue
public static NSArray rawRowsWithQualifierFormat(
com.apple.yellow.eocontrol.EOEditingContext editingContext,
String entityName,
String format,
NSArray arguments)
Creates a qualifier for the specified entity
and with the specified qualifier format and returns matching raw
row dictionaries.See Also: objectsWithQualifierFormat, rawRowsForSQL