Data Consistency

When a JADE session is updating JADE objects, the data must be kept consistent. JADE sessions wanting to update the same object must not interfere with each other, and other sessions viewing the data must not see incomplete updates.

Object locking is used to ensure that only one JADE session at a time can be updating a JADE object. A JADE session must lock an object before it can update it, with a lock type that is available only to one JADE session at a time (that is, an exclusive or an update lock).

JADE sessions can update objects only within a transaction; that is, while the transaction is active (for example, bracketed by JoobContext BeginTransaction and IDbTransaction Commit method calls).

While a transaction is active, any updates are not visible to other JADE sessions. The other JADE sessions instead view the JADE objects, as they were without the uncommitted updates. Committing the transaction causes the updates to be applied to the JADE database and made visible. This is discussed in more detail later in this chapter.