In most applications org.apache.cayenne.access.DataContext is the main user access point to all Cayenne functionality. It provides query execution facilities as well as object state management functions. Applications rarely directly deal with access or mapping objects beyond DataContext.

One of the important features of DataContext is that it isolates changes made in a user session from other users. With this in mind, DataContext normally has a session scope. "Session" can have different meanings in different types of applications. Good example is an HttpSession in a web application. In fact a DataContext is often bound to HttpSession and is reused between requests for the same user.


  1. Obtaining DataContext
  2. Running Queries
  3. DataObject State Management
  4. Moving Objects Between Contexts
  5. DataContextDelegate
  6. DataContextFactory
  7. Nested Contexts
  8. ObjectContext Memory Management