About cycles in the archive domain graph
Two types of cycles can cause issues in the PolicyCenter data model and the archive domain graph:
- Circular foreign key references – Cycles that involve circular references between entities through the use of foreign keys. The concern with this type of cycle is the safe ordering of foreign keys between entities upon bundle commit.
- Ownership cycles – Cycles that involve the ownership of entities in the archive domain graph. The concern with this type of cycle is the ownership, both overt and implicit, of one entity by another in the archive domain graph.
Circular foreign key references
A chain of foreign keys can form a cycle, also known as a circular reference. As an example of a circular reference, entity A has a foreign key to entity B, and B has a foreign key to A. Circular references can occur with more extensive chains of foreign keys, such as A refers to B, which refers to C, which refers to A.
The PolicyCenter data model and the archive domain graph do not permit circular references. Given a bundle that contains a circular reference between entities A and B, PolicyCenter cannot determine which entity to commit first. For example, entity A references new entity B, which has not been committed yet. Thus, committing A before B is committed and present in the database causes a constraint violation.
Edge foreign keys provide the ability to avoid circular references in the data model. An edge foreign key from A to B introduces a new, hidden associative entity with a foreign key to A and a foreign key to B. The edge foreign key associates A and B without foreign keys directly between them. So, PolicyCenter can safely commit entity A first, then new entity B, and finally the hidden edge foreign key entity.
See also
Ownership cycles
A chain of ownership relationships can form a cycle known as an ownership cycle in the archive domain graph. Ownership cycles are hard to detect because ownership can flow either to or from an entity that has a foreign key to another entity.
By default, ownership flows in the same direction as foreign keys. For example, if B has a foreign key to A, B is owned by A. Sometimes it is necessary to invert the flow of ownership, so a foreign key points from the owner to the owned entity instead.
Guidewire strongly recommends against the use of edge foreign keys to resolve ownership cycles in the archive domain graph. Introduce edge foreign keys into the archive domain graph only to resolve circular foreign key references that require edge foreign keys for safe ordering during bundle commit.
