PATH |
EODatabaseChannel
Inherits from: Object
Package: com.webobjects.eoaccess
Class Description
An EODatabaseChannel represents an independent communication channel to the database server. It's associated with an EODatabaseContext and an EODatabase, which, together with the EODatabaseChannel, form the database level of Enterprise Objects Framework's access layer. See the EODatabase class specification for more information.
An EODatabaseChannel has an EOAdaptorChannel that it uses to connect to the database server its EODatabase object represents. An EODatabaseChannel fetches database records as instances of enterprise object classes that are specified in its EODatabase's EOModel objects. An EODatabaseChannel also has an EODatabaseContext, which uses the channel to perform fetches and to lock rows in the database. All of the database level objects are used automatically by EOEditingContexts and other components of Enterprise Objects Framework. You rarely need to interact with them directly. In particular, you wouldn't ordinarily use an EODatabaseChannel to fetch objects. Rather, you'd use an EOEditingContext.
Method Types
Constructors EODatabaseChannel Accessing cooperating objects adaptorChannel databaseContext Fetching objects selectObjectsWithFetchSpecification isFetchInProgress fetchObject cancelFetch Accessing internal fetch state setCurrentEntity setCurrentEditingContext setIsLocking isLocking setIsRefreshingObjects isRefreshingObjects
Constructors
EODatabaseChannel
public EODatabaseChannel(EODatabaseContext aDatabaseContext)
aDatabaseContext is assigned to the new EODatabaseChannel as the DatabaseContext in which the channel works. The new EODatabaseChannel creates an AdaptorChannel with which to communicate with the database server. The constructor throws an exception if the underlying adaptor context can't create a corresponding adaptor channel.
See Also: databaseContext, adaptorChannel
Instance Methods
adaptorChannel
public EOAdaptorChannel adaptorChannel()
See Also: EODatabaseChannel constructor
cancelFetch
public void cancelFetch()
See Also: isFetchInProgress, selectObjectsWithFetchSpecification, fetchObject
databaseContext
public EODatabaseContext databaseContext()
See Also: EODatabaseChannel constructor
fetchObject
public Object fetchObject()
If no snapshot exists for the fetched object, the receiver sends its EODatabase a recordSnapshotForGlobalID message to record one. If a snapshot already exists (because the object was previously fetched), the receiver checks whether it should overwrite the old snapshot with the new one. It does so by asking the delegate with a databaseContextShouldUpdateCurrentSnapshot method. If the delegate doesn't respond to this method, the EODatabaseChannel overwrites the snapshot if it's locking or refreshing fetched objects. Further, if the EODatabaseChannel is refreshing fetched objects, it posts an ObjectsChangedInStoreNotification on behalf of its EODatabaseContext (which causes any EOEditingContext using that EODatabaseContext to update its enterprise object with the values recorded in the new snapshot).
For information on locking and update strategies, see the EODatabaseContext class specification. For information on refreshing fetched objects, see the EOFetchSpecification class specification.
Ordinarily, you don't directly use an EODatabaseChannel to fetch objects. Rather, you use an EOEditingContext, which uses an underlying EODatabaseChannel to do its work.
See Also: cancelFetch, isFetchInProgress, isLocking, isRefreshingObjects
isFetchInProgress
public boolean isFetchInProgress()
isLocking
public boolean isLocking()
See Also: locksObjects (EOFetchSpecification)
isRefreshingObjects
public boolean isRefreshingObjects()
See Also: refreshesRefetchedObjects (EOFetchSpecification), fetchObject
selectObjectsWithFetchSpecification
public void selectObjectsWithFetchSpecification( com.webobjects.eocontrol.EOFetchSpecification fetchSpecification, com.webobjects.eocontrol.EOEditingContext anEditingContext)
Throws an exception if an error occurs; the particular exception depends on the specific error, and is indicated in the exception's description. Some possible reasons for failure are:
- fetchSpecification is invalid.
- The receiver's EODatabaseContext has no transaction in progress.
- The delegate disallows the select operation.
- The receiver's EOAdaptorChannel fails to perform the select operation.
This method invokes the delegate methods databaseContextShouldSelectObjects, databaseContextShouldUsePessimisticLock, and databaseContextDidSelectObjects. See their descriptions in the EODatabaseContext class specification for more information.
You wouldn't ordinarily invoke this method directly; rather, you'd use an EOEditingContext to select and fetch enterprise objects.
See Also: fetchObject
setCurrentEditingContext
public void setCurrentEditingContext(com.webobjects.eocontrol.EOEditingContext anEditingContext)
See Also: setCurrentEntity
setCurrentEntity
public void setCurrentEntity(EOEntity anEntity)
See Also: setCurrentEditingContext
setIsLocking
public void setIsLocking(boolean flag)
An EODatabaseChannel automatically sets this flag according to the fetch specification used in a selectObjectsWithFetchSpecification message. You might invoke this method directly if evaluating SQL directly with EOAdaptorChannel's evaluateExpression method.
See Also: locksObjects (EOFetchSpecification)
setIsRefreshingObjects
public void setIsRefreshingObjects(boolean flag)
An EODatabaseChannel automatically sets this flag according to the fetch specification used in a selectObjectsWithFetchSpecification message. You might invoke this method directly if evaluating SQL directly with EOAdaptorChannel's evaluateExpression: method.
See Also: refreshesRefetchedObjects (EOFetchSpecification)
© 2001 Apple Computer, Inc. (Last Published April 13, 2001)