A method and system for storing and retrieving data in an
object-relational database system includes receiving a query which
results in a request to load a first object. The method also includes
identifying relationship types of other objects having a relationship
with the first object. Then, the first object and those of the other
objects which have a composition relationship with the first object are
eager loaded. Those of the other objects which have an association
relationship with the first object are marked as fault on demand.
Preventing re-faulting of the same object in the same object graph, and
trimming of graphs for serialization are also provided.