As important as storing data, is the ability to retrieve exactly what you are looking for, from the stored data at a later time. OpenAccess ORM provides several techniques for retrieving data stored in supported databases. These include direct navigation of an object graph via object references, using FetchPlans and FetchGroups, retrieving objects by their identifiers and using queries to retrieve objects based on their data values.
One of the key concepts in an object-oriented application is the use of object navigation. Object navigation means following the references from one object to another. OpenAccess ORM gives you a true object-oriented view of the database and, most importantly, maintains the object relationships in storage. This makes direct navigation of the object graph the fastest way to retrieve data. But you have to have at least one object to navigate from. This chapter looks at the various mechanisms available to you for finding and retrieving your objects.
Object navigation is discussed in the first section. Specifically, the concept of persistence by reachability is presented and it also shows how object graphs are stored.
Using the object identifier to retrieve a specific object is presented in the next section. Every object in an OpenAccess ORM database has a unique identifier, i.e. a "primary key" from the database point of view. Using this identifier, you can directly retrieve an object from the database.
Object Identity has to be defined when the object is made persistent (except when a key generator mechanism is used). Using this identifier, you can directly retrieve an object from the database. With Internal Identity, OpenAccess ORM handles the primary key column transparently for you, i.e., the primary key is a surrogate value and not reflected directly as a field in your class. With Single Field Identity, OpenAccess ORM provides you with a mechanism where one exclusive field holds the identity information. The Multiple Field Identity allows you to define which field or fields of your class are used for determining the object identity, or primary key, in the data store.
Object resolution refers to the OpenAccess ORM mechanism of "deferred" loading of the object data in a reference.
Queries provide a powerful and flexible mechanism for finding specific objects based on their data values. OpenAccess ORM supports OQL, the Object Query Language defined by the ODMG, for use in your .NET applications.
Using FetchGroups and FetchPlans: Provides the user with the mechanism to only retrieve those fields, which are needed by the application from the database in as few calls as possible. FetchPlans are used to activate and control FetchGroups dynamically by name. Refer to FetchPlans and FetchGroups for more information.