Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

EOEntity


Inherits from: Object

Implements:
EOPropertyListEncoding
EOSQLExpression.SQLValue

Package: com.webobjects.eoaccess



Class Description


An EOEntity describes a table in a database and associates a name internal to the Framework with an external name by which the table is known to the database. An EOEntity maintains a group of attributes and relationships, which are collectively called properties. These are represented by the EOAttribute and EORelationship classes, respectively; see their specifications for more information.

You usually define entities in a model with the EOModeler application, which is documented in Enterprise Objects Tools and Techniques. EOEntity objects are primarily used by the Enterprise Objects Framework for mapping tables in the database to enterprise objects; your code will probably make limited use of them unless you're specifically working with models.

An EOEntity is associated with a specific class whose instances are used to represent records (rows) from the database in applications using layers at or above the database layer of the Enterprise Objects Framework. If an EOEntity doesn't have a specific class associated with it, instances of EOGenericRecord (defined in EOControl) are created.

An EOEntity may be marked as read-only, in which case any changes to rows or objects for that entity made by the database level objects are denied.

You can define an external query for an EOEntity to be used when a selection is attempted with an unrestricted qualifier (one that would select all rows in the entity's table). An external query is sent unaltered to the database server and so can use database-specific features such as stored procedures; external queries are thus useful for hiding records or invoking database-specific features. You can also assign stored procedures to be invoked upon particular database operations through the use of EOEntity's setStoredProcedure method.

Like the other major modeling classes, EOEntity provides a user dictionary for your application to store any application-specific information related to the entity.

For more information on programmatically creating EOEntity objects, see "Creating an Entity" (page 219).




Constants


EOEntity defines the following String constants:


Constant Description
FetchAllProcedureOperation A stored procedure to fetch all records
FetchWithPrimaryKeyProcedureOperation A stored procedure to fetch by primary key
InsertProcedureOperation A stored procedure to insert a row
DeleteProcedureOperation A stored procedure to delete a row
NextPrimaryKeyProcedureOperation A stored procedure to generate a new primary key



Interfaces Implemented


EOPropertyListEncoding awakeWithPropertyListencodeIntoPropertyList



Method Types


ConstructorsEOEntityAccessing the namesetNamenamebeautifyNameAccessing the modelmodelSpecifying fetching behavior for the entitysetExternalQueryexternalQuerysetRestrictingQualifierrestrictingQualifierAccessing primary key qualifiersqualifierForPrimaryKeyisQualifierForPrimaryKeyAccessing a schema-based qualifier from a qualifier for in-memory evaluationschemaBasedQualifierAccessing attributesaddAttributeanyAttributeNamedattributeNamedattributesremoveAttributeattributesToFetchAccessing relationshipsaddRelationshipanyRelationshipNamedrelationshipsrelationshipNamedremoveRelationshipChecking referential integrityexternalModelsReferencedreferencesPropertyAccessing primary keysglobalIDForRowisPrimaryKeyValidInObjectprimaryKeyForGlobalIDprimaryKeyForRowAccessing primary key attributessetPrimaryKeyAttributesprimaryKeyAttributesprimaryKeyAttributeNamesprimaryKeyRootNameisValidPrimaryKeyAttributeAccessing class propertiessetClassPropertiesclassPropertiesclassPropertyNamesisValidClassPropertyAccessing the enterprise object classclassDescriptionForInstancessetClassNameclassNameAccessing locking attributessetAttributesUsedForLockingattributesUsedForLockingisValidAttributeUsedForLockingAccessing external namesetExternalNameexternalNameexternalNameForInternalNamenameForExternalNameAccessing whether an entity is read onlysetReadOnlyisReadOnlyAccessing the user dictionarysetUserInfouserInfoWorking with stored proceduressetStoredProcedurestoredProcedureForOperationWorking with fetch specificationsaddFetchSpecificationfetchSpecificationNamedfetchSpecificationNamesremoveFetchSpecificationNamedaddSharedObjectFetchSpecificationByNamesharedObjectFetchSpecificationNamessetSharedObjectFetchSpecificationsByNameremoveSharedObjectFetchSpecificationByNameWorking with entity inheritance hierarchiesparentEntitysubEntitiesaddSubEntityremoveSubEntitysetIsAbstractEntityisAbstractEntitySpecifying fault behaviorsetMaxNumberOfInstancesToBatchFetchmaxNumberOfInstancesToBatchFetchCaching objectssetCachesObjectscachesObjects



Constructors



EOEntity

public EOEntity( NSDictionary propertyList, Object owner)

Creates a new EOEntity initialized from propertyList-a dictionary containing only property list data types (that is, NSDictionary, NSArray, NSData, and String). This constructor is used by EOModeler when it reads in an EOModel from a file, for example. The owner argument should be the EOEntity's EOModel. Entities created from a property list must receive an awakeWithPropertyList (EOPropertyListEncoding) message after creation before they are fully functional, but the awake... message should be deferred until the all of the other objects in the model have also been created.

See Also: encodeIntoPropertyList (EOPropertyListEncoding)

public EOEntity()

Description forthcoming.




Static Methods



externalNameForInternalName

public static String externalNameForInternalName( String name, String separatorString, boolean useAllCaps)

Used by the Framework to convert modeling object names to database schema names that conform to a standard convention. A conforming database schema name is upper-case and uses "_" to separate words. Consequently "name" becomes "NAME" and "firstName" becomes "FIRST_NAME".

separatorString is a character that is used to separate words. The Framework uses "_" by default as in the examples above. useAllCaps indicates whether to capitalize the name. For example, providing false converts "firstName" to "first_name".



nameForExternalName

public static String nameForExternalName( String name, String separatorString, boolean initialCaps)

Used by name beautification to convert database schema names to modeling object names that conform to a standard convention. A conforming attribute, relationship, or stored procedure name is lower-case except for the initial letter of each embedded word other than the first, which is upper case. Consequently "NAME" becomes "name" and "FIRST_NAME" becomes "firstName". A conforming entity is all lower-case except for the initial letter of each word. Consequently "CUSTOMER_ACCOUNT" becomes "CustomerAccount".

separatorString is a character that is used to separate words. The Framework uses "_" by default as in the examples above. initialCaps indicates whether to capitalize the first letter of the first word. By default, the Framework uses true for entities and false for everything else.

See Also: beautifyNames (EOModel), beautifyName, - beautifyName (EOAttribute, EORelationship, EOStoredProcedure)




Instance Methods



addAttribute

public void addAttribute(EOAttribute anAttribute)

Adds anAttribute to the receiver. Throws an exception if anAttribute's name is already in use by another attribute or relationship. Sets anAttribute's entity to this.

See Also: removeAttribute, attributes, attributeNamed



addFetchSpecification

public void addFetchSpecification( com.webobjects.eocontrol.EOFetchSpecification fetchSpec, String fetchSpecName)

Adds the fetch specification and associates fetchSpecName with it.

See Also: fetchSpecificationNamed, fetchSpecificationNames, removeFetchSpecificationNamed



addRelationship

public void addRelationship(EORelationship aRelationship)

Adds aRelationship to the receiver. Throws an exception if aRelationship's name is already in use by another attribute or relationship. Sets aRelationship's entity to this.

See Also: removeRelationship, relationships, relationshipNamed



addSharedObjectFetchSpecificationByName

public void addSharedObjectFetchSpecificationByName(String name)

Adds the fetch specification identified by name to the set of fetch specifications used to load objects into a shared editing context.



addSubEntity

public void addSubEntity(EOEntity child)

Causes the child entity child to "inherit" from the receiver. This is the first step in setting up an inheritance hierarchy between entities.

See Also: subEntities, removeSubEntity



anyAttributeNamed

public EOAttribute anyAttributeNamed(String attributeName)

Returns the user-created attribute identified by attributeName. If no such attribute exists, this method looks through the "hidden" attributes created by the Enterprise Objects Framework for one with the given name. Hidden attributes are used for such things as primary keys on target entities of flattened attributes. If none is found, null is returned.

See Also: attributeNamed, attributes



anyRelationshipNamed

public EORelationship anyRelationshipNamed(String relationshipName)

Returns the user-created relationship identified by relationshipName. If none exists, this method looks through the "hidden" relationships created by the Enterprise Objects Framework for one with the given name. If none is found, null is returned.

See Also: relationshipNamed, relationships



attributeNamed

public EOAttribute attributeNamed(String attributeName)

Returns the attribute named attributeName, or null if no such attribute exists.

See Also: anyAttributeNamed, attributes, relationshipNamed



attributes

public NSArray attributes()

Returns all of the receiver's attributes, or null if the receiver has none.

See Also: anyAttributeNamed, attributeNamed



attributesToFetch

public NSArray attributesToFetch()

Returns an array of the EOAttributes that need to be fetched so that they can be included in the row snapshot. The set of attributes includes:

  1. Attributes that are class properties, "used for locking," or primary keys.
  2. Source attributes of any to-many relationship (flattened or non-flattened) that is a class property.
  3. Source attributes of any non-flattened, to-one relationship that is a class property or that is used by a flattened attribute that is a class property.
  4. The foreign key attributes of any flattened, to-one relationship that is a class property or that is used by a class property.



attributesUsedForLocking

public NSArray attributesUsedForLocking()

Returns an array containing those properties whose values must match a snapshot any time a row is updated.

Attributes used for locking are those whose values are compared when a database-level object performs an update. When the database-level classes fetch an enterprise object, they cache these attributes' values in a snapshot. Later, when the enterprise object is updated, the values of these attributes in the object are checked with those in the snapshot-if they differ, the update fails. See the EODatabaseContext class specification for more information.



awakeWithPropertyList

public void awakeWithPropertyList(NSDictionary pList)

Description forthcoming.



beautifyName

public void beautifyName()

Makes the receiver's name conform to a standard convention. EOEntity names that conform to this style are all lower-case except for the initial letter of each word, which is upper case. Thus, "MOVIE" becomes "Movie", and "MOVIE_ROLE" becomes "MovieRole".

See Also: setName, beautifyNames (EOModel)



cachesObjects

public boolean cachesObjects()

Returns true if all of the objects from the receiver are to be cached in memory and queries are to be evaluated in-memory using this cache rather than in the database. This method should only be used for fairly small tables of read-only objects, since the first access to the receiver will trigger fetching the entire table. You should generally restrict this method to read-only entities to avoid cached data getting out of sync with database data. Also, you shouldn't use this method if your application will be making queries against the entity that can't be evaluated in memory.

See Also: setCachesObjects



classDescriptionForInstances

public com.webobjects.eocontrol.EOClassDescription classDescriptionForInstances()

Returns the EOClassDescription associated with the receiver. The EOClassDescription class provides a mechanism for extending classes by giving them access to the metadata contained in an EOModel (or another external source of information). In an application, EOClassDescriptions are registered on demand for the EOEntity on which an enterprise object is based. For more information, see the class specifications for EOClassDescription (in EOControl) and EOEntityClassDescription.



className

public String className()

Returns the name of the enterprise object class associated with the receiver. When a row is fetched for the receiver by a database-level object, it's returned as an instance of this class. This class might not be present in the run-time system, and in fact your application may have to load it on demand. If your application doesn't load a class, EOGenericRecord is used.

An enterprise object class other than EOGenericRecord can be mapped to only one entity.



classProperties

public NSArray classProperties()

Returns an array containing the properties that are bound to the receiver's class (so that instances of the class will be passed values corresponding to those properties). This is a subset of the receiver's attributes and relationships.

See Also: classPropertyNames



classPropertyNames

public NSArray classPropertyNames()

Returns an array containing the names of those properties that are bound to the receiver's class (so that instances of the class will be passed values corresponding to those properties). This is a subset of the receiver's attributes and relationships.

See Also: classProperties



clientClassName

public String clientClassName()

Returns the name of the client-side enterprise object class associated with the receiver. If no client-side class name has yet been registered for the receiver, this method returns the name of the receiving class (either EOEntity or a subclass of EOEntity). Equivalent to the 4.5 com.webobjects.eodistribution.EOAccessAdditions's clientClassNameForEntity.



clientClassProperties

public NSArray clientClassProperties()

Returns an array containing the properties that are bound to the client-side class corresponding to the receiver. If no information about the client-side class's properties is available, this method returns the receiver's class properties. The properties returned by this method are the attributes and relationships that are used by the client. Only these attributes and relationships will be shipped to the client. Equivalent to the 4.5 com.webobjects.eodistribution.EOAccessAdditions's clientClassPropertiesForEntity.



clientClassPropertyNames

public NSArray clientClassPropertyNames()

Returns an array containing the names of the properties that are bound to the client-side class corresponding to the receiver. If no information about the client-side class's properties is available, this method returns the names of the receiver's class properties. The property names returned by this method are the attributes and relationships that are used by the client. Only these attributes and relationships will be shipped to the client. Equivalent to the 4.5 com.webobjects.eodistribution.EOAccessAdditions's clientClassPropertyNamesForEntity.



encodeIntoPropertyList

public void encodeIntoPropertyList(NSMutableDictionary aDictionary)

Description forthcoming.



externalModelsReferenced

public NSArray externalModelsReferenced()

Examines each of the receiver's relationships and returns a list of all external models referenced by the receiver.

See Also: referencesProperty



externalName

public String externalName()

Returns the name of the receiver as understood by the database server.



externalQuery

public String externalQuery()

Returns a query statement that's used by an EOAdaptorChannel to select rows for the receiver when a qualifier is empty, or null if the receiver has no external query. An empty qualifier is one that specifies only the entity, and would thus fetch all enterprise objects for that entity.

External queries are useful for hiding records or invoking database-specific features such as stored procedures when an application attempts to select all records for an entity. You can also use the EOStoredProcedure class to work with stored procedures; for more information see the EOStoredProcedure class specification.

See Also: setExternalQuery



fetchSpecificationNamed

public com.webobjects.eocontrol.EOFetchSpecification fetchSpecificationNamed(String fetchSpecName)

Returns the fetch specification associated with fetchSpecName.

See Also: addFetchSpecification, fetchSpecificationNames, removeFetchSpecificationNamed



fetchSpecificationNames

public NSArray fetchSpecificationNames()

Returns an alphabetically sorted array of names of the entity's fetch specifications.

See Also: addFetchSpecification, fetchSpecificationNamed, removeFetchSpecificationNamed



globalIDForRow

public com.webobjects.eocontrol.EOGlobalID globalIDForRow(NSDictionary row)

Constructs a global identifier from the specified row for the receiver.

See Also: primaryKeyForGlobalID



isAbstractEntity

public boolean isAbstractEntity()

Returns true to indicate that the receiver is abstract, false otherwise. An abstract entity is one that has no corresponding enterprise objects in your application. Abstract entities are used to model inheritance relationships. For example, you might have a Person abstract entity that acts as the parent of Customer and Employee entities. Customer and Employee would inherit certain characteristics from Person (such as name and address attributes). However, though your application might have Customer and Employee objects, it would never have a Person object.

See Also: setIsAbstractEntity



isPrimaryKeyValidInObject

public boolean isPrimaryKeyValidInObject(NSKeyValueCoding anObject)

Returns true if every key attribute is present in anObject and has a value that is not null. Returns false otherwise. This method uses the EOKeyValueCoding interface so a dictionary may be provided instead of an enterprise object.

See Also: primaryKeyForRow



isQualifierForPrimaryKey

public boolean isQualifierForPrimaryKey(com.webobjects.eocontrol.EOQualifier aQualifier)

Returns true if aQualifier describes the primary key and nothing but the primary key, false otherwise.



isReadOnly

public boolean isReadOnly()

Returns true if the receiver can't be modified, false if it can. If an entity can't be modified, then enterprise objects fetched for that entity also can't be modified (that is, inserted, deleted, or updated).



isValidAttributeUsedForLocking

public boolean isValidAttributeUsedForLocking(EOAttribute anAttribute)

Returns false if anAttribute isn't an EOAttribute, if the EOAttribute doesn't belong to the receiver, or if anAttribute is derived. Otherwise returns true. An attribute that isn't valid for locking will cause setAttributesUsedForLocking to fail.

See Also: attributesUsedForLocking



isValidClassProperty

public boolean isValidClassProperty(Object aProperty)

Returns false if either aProperty isn't an EOAttribute or EORelationship, or if aProperty doesn't belong to the receiver. Otherwise returns true. Note that this method doesn't tell you whether aProperty is a member of the array returned by classProperties. In other words, unlike classProperties, classPropertyNames, and setClassProperties, this method doesn't interact with the properties bound to the entity's enterprise object class.



isValidPrimaryKeyAttribute

public boolean isValidPrimaryKeyAttribute(EOAttribute anAttribute)

Returns false if anAttribute isn't an EOAttribute, doesn't belong to the receiver, or is derived. Otherwise returns true.

See Also: setPrimaryKeyAttributes



maxNumberOfInstancesToBatchFetch

public int maxNumberOfInstancesToBatchFetch()

Returns the maximum number of to-one faults from the receiver to fire at one time. See the method description for setMaxNumberOfInstancesToBatchFetch for more explanation of what this means.



model

public EOModel model()

Returns the model that contains the receiver.

See Also: addEntity (EOModel)



name

public String name()

Returns the receiver's name.



parentEntity

public EOEntity parentEntity()

Returns the entity from which the receiver inherits.

See Also: subEntities



primaryKeyAttributeNames

public NSArray primaryKeyAttributeNames()

Returns an array containing the names of the attributes that make up the receiver's primary key.

See Also: primaryKeyAttributes



primaryKeyAttributes

public NSArray primaryKeyAttributes()

Returns an array of those attributes that make up the receiver's primary key.

See Also: primaryKeyAttributeNames



primaryKeyForGlobalID

public NSDictionary primaryKeyForGlobalID(com.webobjects.eocontrol.EOGlobalID globalID)

Returns the primary key for the object identified by globalID.

See Also: globalIDForRow



primaryKeyForRow

public NSDictionary primaryKeyForRow(NSDictionary aRow)

Returns the primary key for aRow, or null if the primary key can't be computed. The primary key is a dictionary whose keys are attribute names and whose values are values for those attributes.

See Also: primaryKeyForGlobalID



primaryKeyRootName

public String primaryKeyRootName()

Returns the external name (that is, the name as it's understood by the database) of the receiver's root entity. If the receiver has no parent entity, returns the receiver's external name.

See Also: externalName, name, parentEntity



qualifierForPrimaryKey

public com.webobjects.eocontrol.EOQualifier qualifierForPrimaryKey(NSDictionary aRow)

Returns a qualifier for the receiver that can be used to fetch an instance of the receiver with the primary key extracted from aRow.

See Also: isQualifierForPrimaryKey, restrictingQualifier



referencesProperty

public boolean referencesProperty(Object aProperty)

Returns true if any of the receiver's attributes or relationships reference aProperty, false otherwise. A property can be referenced by a flattened attribute or by a relationship. For example, suppose a model has an Employee entity with a toDepartment relationship. If you flatten the department's name attribute into the Employee entity, creating a departmentName attribute, that flattened attribute references the toDepartment relationship.

If an entity has any outstanding references to a property, you shouldn't remove the property.

See Also: removeAttribute, removeRelationship



relationshipNamed

public EORelationship relationshipNamed(String name)

Returns the relationship named name, or null if the receiver has no such relationship.

See Also: anyRelationshipNamed, attributeNamed, relationships



relationships

public NSArray relationships()

Returns all of the receiver's relationships, or null if the receiver has none.

See Also: attributes



removeAttribute

public void removeAttribute(EOAttribute name)

Removes the attribute named name if it exists. You should always use referencesProperty to check that an attribute isn't referenced by another property before removing it.

See Also: addAttribute, attributes



removeFetchSpecificationNamed

public void removeFetchSpecificationNamed(String fetchSpecName)

Removes the fetch specification referred to by fetchSpecName.

See Also: addFetchSpecification, fetchSpecificationNamed, fetchSpecificationNames



removeRelationship

public void removeRelationship(EORelationship name)

Removes the relationship named name if it exists. You should always use referencesProperty to check that a relationship isn't referenced by another property before removing it.

See Also: addRelationship, relationships



removeSharedObjectFetchSpecificationByName

public void removeSharedObjectFetchSpecificationByName(String name)

Removes the fetch specification identified by name from the set of fetch specifications used to load objects into a shared editing context.



removeSubEntity

public void removeSubEntity(EOEntity child)

Removes child from the receiver's list of sub-entities.

See Also: addSubEntity, subEntities



restrictingQualifier

public com.webobjects.eocontrol.EOQualifier restrictingQualifier()

Returns the qualifier used to restrict all queries made against the receiver. Restricting qualifiers are useful when there is not a one-to-one mapping between an entity and a particular database table, or when you always want to filter the data that's returned for a particular entity.

For example, if you're using the "one table" inheritance model in which parent and child data is contained in the same table, you'd use a restricting qualifier to fetch objects of the appropriate type. To give a non-inheritance example, for an Employees table you might create a "Sales" entity that has a restricting qualifier that only fetches employees who are in the Sales department.

See Also: setRestrictingQualifier



schemaBasedQualifier

public com.webobjects.eocontrol.EOQualifier schemaBasedQualifier( com.webobjects.eocontrol.EOQualifier aQualifier)

Returns a qualifier based on aQualifier suitable for evaluation by a database (as opposed to in-memory evaluation). Invoked by an EODatabaseChannel object before it uses its EOAdaptorChannel to perform a database operation.

Whereas in-memory qualifier evaluation uses object instance variables to resolve relationships, a database qualifier must use foreign keys. For example, consider a qualifier that is used to fetch all employees who work in a specified department:





Department dept; // Assume this exists. EOQualifier qualifier; NSMutableArray qualArgs = new NSMutableArray(); qualArgs.addObject(dept); qualifier = EOQualifier.qualifierWithQualifierFormat("department = %@", qualArgs);


For an in-memory search, the Framework queries employee objects for their department object and includes an employee in the result list if its department object is equal to dept. (See EOControl's EOQualifierEvaluation interface description for more information on in-memory searching.)

For a database search, the Framework needs to qualify the fetch by specifying a foreign key value for dept. The Framework sends the EOEntity class a schemaBasedQualifier message that creates a new EOQualifier object from qualifier. Assume that the entity for employee objects has an attribute named departmentID and that the primary key value for dept is 459, the resulting qualifier specifies the search conditions as:





department.departmentID = 459


See Also: selectObjectsWithFetchSpecification (EODatabaseChannel)



setAttributesUsedForLocking

public boolean setAttributesUsedForLocking(NSArray attributes)

Sets attributes as the attributes used when an EODatabaseChannel locks enterprise objects for updates. Returns false and doesn't set the attributes used for locking if any of the attributes in attributes responds false to isValidAttributeUsedForLocking; returns true otherwise. See the EODatabase, EODatabaseContext, and EODatabaseChannel class specifications for information on locking.



setCachesObjects

public void setCachesObjects(boolean flag)

Sets according to flag whether all of the receiver's objects are cached the first time the associated table is queried.

See Also: cachesObjects



setClassName

public void setClassName(String name)

Assigns name as the name of the class associated with the receiver or "EOGenericRecord" if name is null. The specified class need not be present in the run-time system when this message is sent. When an EODatabaseChannel fetches objects for the receiver, they're created as instances of this class. Your application may have to load the class on demand if it isn't present in the run-time system; if it doesn't load the class, EOGenericRecord will be used.

An enterprise object class other than EOGenericRecord can be mapped to only one entity.

See Also: className



setClassProperties

public boolean setClassProperties(NSArray properties)

Sets the receiver's class properties to the EOAttributes and EORelationships in properties and returns true, unless the receiver responds false to isValidClassProperty for any of the objects in the array. In this event, the receiver's class properties aren't changed and false is returned.



setExternalName

public void setExternalName(String name)

Sets the name of the receiver as understood by the database server to name. For example, though your application may know the entity as "JobTitle" the database may require a form such as "JOB_TTL". An adaptor uses the external name to communicate with the database; your application should never need to use the external name.



setExternalQuery

public void setExternalQuery(String aQuery)

Assigns aQuery as the query statement used for selecting rows from the receiver when there is no qualifier.

External queries are useful for hiding records or invoking database-specific features such as stored procedures when an application attempts to select all records for an entity. You can also use the EOStoredProcedure class to work with stored procedures; for more information see the EOStoredProcedure class specification.

An external query is sent unaltered to the database server, and so must contain the external (column) names instead of the names of EOAttributes. However, to work properly with the adaptor the external query must use the columns in alphabetical order by their corresponding EOAttributes' names.

See Also: columnName (EOAttribute), externalQuery



setIsAbstractEntity

public void setIsAbstractEntity(boolean flag)

Sets according to flag whether the receiver is an abstract entity. For more discussion of abstract entities, see the method description for isAbstractEntity.



setMaxNumberOfInstancesToBatchFetch

public void setMaxNumberOfInstancesToBatchFetch(int size)

Sets the maximum number of faults from the receiver to trigger at one time. By default, only one object is fetched from the database when you trigger a fault. You can optionally use this method to set to size the number of faults of the same entity should be fetched from the database along with the first one. Using this technique helps to optimize performance by taking advantage of round trips to the database.

See Also: maxNumberOfInstancesToBatchFetch



setName

public void setName(String name)

Sets the receiver's name to name. Throws an exception NSInvalidArgumentException if name is already in use by another entity in the same EOModel or if name is not a valid entity name.

See Also: beautifyName



setPrimaryKeyAttributes

public boolean setPrimaryKeyAttributes(NSArray keys)

If the receiver responds false to isValidPrimaryKeyAttribute for any of the objects in keys, this method returns false. Otherwise, this method sets the primary key attributes to the attributes in keys and returns true.

You should exercise care in choosing primary key attributes. Floating-point numbers, for example, can't be reliably compared for equality, and are thus unsuitable for use in primary keys. Integer and string types are the safest choice for primary keys. BigDecimal NSDecimalNumber objects will work, but they'll entail more overhead than integers.

See Also: isValidPrimaryKeyAttribute



setReadOnly

public void setReadOnly(boolean flag)

Sets according to flag whether the database rows for the receiver can be modified by the database level objects.

See Also: isReadOnly



setRestrictingQualifier

public void setRestrictingQualifier(com.webobjects.eocontrol.EOQualifier aQualifier)

Assigns aQualifier as the qualifier used to restrict all queries made against the receiver. The restricting qualifier can be used to map an entity to a subset of the rows in a table. For more discussion of this subject, see the description for restrictingQualifier.



setSharedObjectFetchSpecificationsByName

public void setSharedObjectFetchSpecificationsByName(NSArray names)

Sets the fetch specifications used to load objects into a shared editing context to the fetch specifications identified by name in the provided array, names.



setStoredProcedure

public void setStoredProcedure( EOStoredProcedure storedProcedure, String operation)

Sets storedProcedure for operation. operation can be one of the following:

This information is used when changes from the object graph have been transformed into EODatabaseOperations that are being used to construct EOAdaptorOperations. At this point, Enterprise Objects Framework checks the entities associated with the changed objects to see if the entities have any stored procedures defined for the operation being performed.

See Also: storedProcedureForOperation



setUserInfo

public void setUserInfo(NSDictionary dictionary)

Sets the dictionary of auxiliary data, which your application can use for whatever it needs. dictionary can only contain property list data types-that is, String, NSDictionary, NSArray, and NSData.



sharedObjectFetchSpecificationNames

public NSArray sharedObjectFetchSpecificationNames()

Returns an array of strings, which are the names of the fetch specifications used to load objects into a shared editing context.



storedProcedureForOperation

public EOStoredProcedure storedProcedureForOperation(String operation)

Returns the stored procedure for the specified operation, if one has been set. Otherwise, returns null. operation can be one of the following:

See Also: setStoredProcedure, parameterDirection (EOAttribute), storedProcedure (EOAttribute)



subEntities

public NSArray subEntities()

Returns a list of those entities which inherit from the receiver.

See Also: addSubEntity, parentEntity, removeSubEntity



toString

public String toString()

Returns a String representation of the receiver.



userInfo

public NSDictionary userInfo()

Returns a dictionary of user data. Your application can use this to store any auxiliary information it needs.

See Also: setUserInfo



valueForSQLExpression

public String valueForSQLExpression(EOSQLExpression context)

Conformance to EOSQLExpression.SQLValue.



© 2001 Apple Computer, Inc. (Last Published April 13, 2001)


Table of Contents