6.2.5.4 Reference

A REFERENCE property stores the UUID of a referenceable node (one having type mix:referenceable). The referential integrity of REFERENCE properties must be guaranteed.

In level 2 implementations, enforcement of referential integrity means that when a node is removed, a check must be done to ensure that no REFERENCE properties in the workspace still refer to nodes in the subtree to be removed. This check is done when an attempt is made to persist the removal of a node (that is, either on save, or, if the change was made within a transaction, on commit; in any case, the check is not done immediately on remove). If any references to a node in the subtree to be removed exist, a ReferentialIntegrityException is thrown.

An exception is made to the referential integrity rule when the REFERENCE property in question is part of the frozen state of a version stored in version storage. In that case the frozen REFERENCE property may hold the UUID of a node that is no longer in the workspace (see 8.2.2.9 Reference Properties within a Version).