Understanding PolicyCenter entity ownership

Guidewire defines the ownership of one entity by another by defining a foreign key between the two entities. Generally, foreign keys point from owned entities to owning entities in the archive domain graph. Thus, a foreign key to entity A from entity B indicates that entity A owns entity B.

Guidewire explicitly defines the relationship between the owned and owning entity in an entity metadata definition by adding an archivingOwner attribute to the <foreignkey> element definition. For example:

<?xml version="1.0"?>
<entity xmlns="http://guidewire.com/datamodel" desc="Notes added by users" entity="Note"... >
  ...
  <foreignkey
    columnName="ActivityID"
    desc="The activity associated with the note."
    archivingOwner="..."
    exportable="false"
    fkentity="Activity"
    name="Activity"
    nullok="true"/>
  ...
</entity>

The archivingOwner attribute can be any of the following values:

  • none – There is no ownership relationship between the source and the target of the link.
  • target – The target of the foreign key owns the link.
  • source – The source of the foreign key owns the link. Guidewire calls this type of link an inverse foreign key.

You use the value of the archivingOwner attribute to set the direction of the link that the foreign key represents.

The following table summarizes these concepts.

Ownership

Description

Entity ownership

A child entity (B) has a foreign key to its parent entity (A). The foreign key definition includes setting attribute archivingOwner to target, which indicates that A (the target) owns B (the source). If this attribute is missing from the foreign key definition, PolicyCenter assumes a value of target, the default.

For example, in the base PolicyCenter configuration, entity Note has a foreign key relationship with the PolicyPeriod entity. See also Ownership through the effective dated branch.

Inverse ownership

A child entity (B) has a foreign key to its parent entity (A). However, the foreign key definition sets attribute archivingOwner to source, which indicates that B (the source) owns A (the target). Thus, the direction of the foreign key for ownership is the inverse of typical entity ownership.

For example, in the base PolicyCenter configuration, entity Contact has a foreign key relationship with the Address entity.

IMPORTANT Guidewire discourages the use of inverse ownership relationships. The PolicyCenter data model supports inverse ownership relationships for the rare case in which upgrading the database is unduly cumbersome or time consuming. As a general rule, do not use this type of relationship.

Foreign key ownership in the archive domain graph

A foreign key defines an ownership relationship between two entities. Generally, foreign keys point from owned entities to owning entities in the archive domain graph.

The following graphic illustrates this concept.


In a foreign key relationship between two entities, the owned entity contains the foreign key that points to the owning entity.

To illustrate, in the base PolicyCenter configuration, Note has a foreign key to PolicyPeriod. The following Note metadata definition extension shows this relationship.

<internalExtension xmlns="http://guidewire.com/datamodel"
        entityName="Note" javaClass="com.guidewire.pc.domain.note.Note">
  ...
  <foreignkey columnName="PolicyPeriodID"
        desc="Associated Policy Period."
        exportable="false"
        fkentity="PolicyPeriod"
        name="PolicyPeriod"/>
  ...
</internalExtension>

As the foreign key does not provide a value for the archivingOwner attribute, PolicyCenter uses its default value, which is target. Thus, the owner of the Note entity is the PolicyPeriod entity.

Note: A Note also can be owned by other entities, such as Job.

Inverse foreign key ownership in the archive domain graph

Important: Guidewire discourages the use of inverse ownership relationships. The PolicyCenter data model supports inverse ownership relationships for the rare case in which upgrading the database is unduly cumbersome or time consuming. Do not use this type of relationship as a general rule.

A foreign key defines an ownership relationship between two entities. Generally, foreign keys point from owned entities to owning entities in the archive domain graph. However, in certain rare cases, it is possible to define a foreign key that points from the owning entity to the owned entity in the archive domain graph.

The following graphic illustrates this concept.


In an inverse foreign key relationship between two entities, the owned entity still contains the foreign key that points to the owning entity. However, in this case, the foreign key element contains an archivingOwner attribute set to 'source', which indicates the reverse relationship.

To illustrate, in the base PolicyCenter configuration, Contact and Address have an ownership relationship, with a foreign key from Contact to Address. The following Contact metadata definition shows this relationship.

<?xml version="1.0"?>
<entity desc="Represents a generic contact like a person or a business." entity="Contact" ...>
  ...
  <foreignkey archivingOwner="source"
        columnName="PrimaryAddressID"
        desc="Primary address associated with the contact."
        fkentity="Address"
        name="PrimaryAddress"
        nullok="true"
        triggersValidation="true"/>
  ...
</entity>

The archivingOwner attribute of source on the Address foreign key indicates an inverse ownership relationship. Thus, the Contact entity is the owner of the Address entity.

Ownership through the effective dated branch

In PolicyCenter, an effective dated entity is owned by the root of the effective dated branch. For example, PolicyLocation is an effective dated entity owned by PolicyPeriod.

The following PolicyLocation metadata definition illustrates how an effective dated entity is owned by PolicyPeriod.

<entity ... effDatedBranchType="PolicyPeriod" entity="PolicyLocation" ... type="effdated">