Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The context object contains a cache (question) of objects.

Differences between DSpace 5 and DSpace 6 Context

In DSpace 5, each "Context" established a new DB connection. Context then committed or aborted the connection after it was done (based on results of that request).  Context could also be shared between methods if a single transaction needed to perform actions across multiple methods.

In DSpace 6, Hibernate manages the DB connection pool.  Each thread grabs a Hibernate Session (which corresponds to a DB connection) from the pool. This means two Context objects could use the same DB connection (if they are in the same thread). In other words, code can no longer assume each new Context() is treated as a new/separate database transaction.

Read Only Context

The Context object can be set to a read only mode for enhanced performance when processing many database objects in a read-only fashion.

...