Class DataContext.Builder

java.lang.Object
org.apache.cayenne.access.DataContext.Builder
Enclosing class:
DataContext

public static class DataContext.Builder extends Object
A builder of DataContext instances. Created via DataContext.builder(DataChannel).
Since:
5.0
  • Constructor Details

  • Method Details

    • snapshotCache

      public DataContext.Builder snapshotCache(DataRowStore snapshotCache)
      Sets a snapshot cache for the context's ObjectStore. Nested contexts have no cache of their own and take snapshots from the parent context instead. Default is no cache.
    • objectMap

      public DataContext.Builder objectMap(Map<ObjectId, Persistent> objectMap)
      Sets a map to store registered objects in. The map determines how strongly the context retains objects. Default is a map with weak references to the values.
    • syncWithSnapshotCache

      public DataContext.Builder syncWithSnapshotCache(boolean sync)
      Sets whether the context's ObjectStore should listen to snapshot cache events, updating its objects with changes made in other contexts. Default is false.
    • usingSharedSnapshotCache

      public DataContext.Builder usingSharedSnapshotCache(boolean usingSharedSnapshotCache)
      Sets whether the snapshot cache is the shared cache of the parent DataDomain. Unless set explicitly, this is determined by comparing the snapshot cache with the shared cache of the channel's DataDomain.
    • validatingObjectsOnCommit

      public DataContext.Builder validatingObjectsOnCommit(boolean validating)
      Sets whether the context validates objects before commit. Default is true.
    • queryCache

      public DataContext.Builder queryCache(QueryCache queryCache)
      Sets a cache for query results. Default is no cache.
    • build

      public DataContext build()