Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Accessing Lower-Level Objects

Advanced users may need to access an editing context’s access layer or adaptor layer objects. To access an editing context’s access layer objects, you get an editing context’s object store coordinator and the object store coordinator’s database context object. From the database context object, you can get the database context’s adaptor-level objects.

An editing context can have more than one set of access layer and adaptor layer objects, so you need to identify which set you’re looking for. You can do this a number of ways: with a fetch specification, with a global ID, or with an enterprise object. The code in “Listing 5-2” uses a fetch specification to help the root object store determine which of its cooperating object stores can service your request.

Listing 4-2  Accessing lower-level objects

EOEditingContext editingContext; //Assume this exists.
EOFetchSpecification fetchSpec;
EOObjectStoreCoordinator rootObjectStore;
EODatabaseContext databaseContext;
EOAdaptor adaptor;
EOAdaptorContext adaptorContext;
 
fetchSpec = new EOFetchSpecification(entityName, null, null);
rootObjectStore = (EOObjectStoreCoordinator)editingContext.rootObjectStore();
databaseContext = (EODatabaseContext)rootObjectStore.objectStoreForFetchSpecification(fetchSpec);
adaptor = databaseContext.database().adaptor();
adaptorContext = databaseContext.adaptorContext();



< Previous PageNext Page > Hide TOC


Last updated: 2007-07-11




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice