Class DataContext

The most common implementation of ObjectContext. DataContext is an
isolated container of an object graph, in a sense that any uncommitted
changes to persistent objects that are registered with the context, are not
visible to the users of other contexts.

currentSnapshot

Warning: This method will return a partial snapshot if
an object or one of its related objects that propagate their keys to this
object have temporary ids. DO NOT USE this method if you expect a DataRow
to represent a complete object state.

commitChangesToParent

public void commitChangesToParent()

"Flushes" the changes to the parent DataChannel. If the parent
channel is a DataContext, it updates its objects with this context's
changes, without a database update. If it is a DataDomain (the most
common case), the changes are written to the database. To cause cascading
commit all the way to the database, one must use commitChanges()
.

iterator

Creates a ResultIterator based on the provided query. It is usually
backed by an open result set and is useful for processing of large data
sets, preserving a constant memory footprint. The caller must wrap
iteration in try/finally (or try-with-resources for Java 1.7 and higher) and
close the ResultIterator explicitly.
Or use ObjectContext.iterate(Select, ResultIteratorCallback) as an alternative.

performIteratedQuery

Performs a single database select query returning result as a
ResultIterator. It is caller's responsibility to explicitly close the
ResultIterator. A failure to do so will result in a database connection
not being released. Another side effect of an open ResultIterator is that
an internal Cayenne transaction that originated in this method stays open
until the iterator is closed. So users should normally close the iterator
within the same thread that opened it.

performQuery

Returns a list of objects or DataRows for a named query stored in one of
the DataMaps. Internally Cayenne uses a caching policy defined in the
named query. If refresh flag is true, a refresh is forced no matter what
the caching policy is.

Parameters:

queryName - a name of a GenericSelectQuery defined in one of the DataMaps.
If no such query is defined, this method will throw a
CayenneRuntimeException.

expireCachedLists - A flag that determines whether refresh of cached lists
is required in case a query uses caching.

Since:

1.1

performQuery

Returns a list of objects or DataRows for a named query stored in one of
the DataMaps. Internally Cayenne uses a caching policy defined in the
named query. If refresh flag is true, a refresh is forced no matter what
the caching policy is.

Parameters:

queryName - a name of a GenericSelectQuery defined in one of the DataMaps.
If no such query is defined, this method will throw a
CayenneRuntimeException.

parameters - A map of parameters to use with stored query.

expireCachedLists - A flag that determines whether refresh of cached lists
is required in case a query uses caching.

Since:

1.1

isUsingSharedSnapshotCache

public boolean isUsingSharedSnapshotCache()

Returns true if the ObjectStore uses shared cache of a
parent DataDomain.