
to be changed, because A cannot have its pointers
dereferenced while being on disk. In Figure 8.3(c), Object
A is also brought into memor y. Now, any pointers between
A and B become in-memory pointers rather than persistent
pointers. But pointers to and from disk objects remain
unchanged. Finally, in Figure 8.3(d) Object B is now placed
back into disk, and object C brought into memory instead.
All pointers to B from in-memory objects, such as A, have
to be converted back to persistent pointers. However, poi-
nters between C and in-memory objects, such as A, now
become in-memory pointers.
One way to address these challenges with persistent
objects
is to have
two distinct “flavors” of objects: those
that are persistent, and those that are in-memory. Thus,
for example, we could have an object class Queue and
another object class Persistent_queue. Object instances of
the former type would have ordinary object identifiers,
whereas those of the latter would have the large persistent
object identifiers.
However, this proposed solution introduces more pro-
blems of its own. When an object is referenced, the
referencing object must know whether the object it
references is persistent or not. Furthermore, it makes no
sense for a persistent object to reference an in-memory
object, because the latter may not be there the next time
someone looks at the persistent object. These choices are
not easy to make, and could lead to a combinatorial explo-
sion of object types, one for each different type of refer-
ence. Furthermore, we require that objects be in memory
to operate on them. Therefore, access to persistent objects
will involve copying them into temporary in-memory
objects, of a different object class, before manipulating
them. That is to say, to be able to add an entry to a persis-
tent queue, we have to copy it into an in-memory queue,
add the entry, and then copy it back to the persistent
queue. This is a great deal of computational effort and
complexity for a simple task.
To avoid these difficulties, object-oriented database sys-
tems introduce a requirement for orthogonality between
persistence and type. By this we mean that types in the per-
sistent program language, or object classes in our terms,
should not specify whether they are persistent. It should
148 Chapter 8 OBJECT-RELATIONAL DESIGN