<onetoone>

The <onetoone> element defines a single-valued association to another entity that has a one-to-one cardinality. Guidewire defines this element in the data model metadata files as the <onetoone> XML subelement. A one-to-one element functions in a similar manner to a foreign key in that it makes a reference to another entity. However, its purpose is to provide a reverse pointer to an entity or object that is pointing at the <onetoone> entity, through the use of a foreign key.

For example, entity A has a foreign key to entity B. You can associate an instance of B with at most one instance of A. Perhaps, there is a unique index on the foreign key column. This then defines a one-to-one relationship between A and B. You can then declare the <onetoone> element on B, to provide simple access to the associated A. In essence, using a one-to-one element creates an array-of-one, with, at most, one element. Zero elements are also possible.

Note: PolicyCenter labels one-to-one elements in the Guidewire Data Dictionary as foreign keys. You access these elements in Gosu code in the same manner as you access foreign keys.

Attributes of <onetoone>

The <onetoone> element contains the following attributes.

<onetoone>  attribute      

Description

Default

cascadeDelete

If true, then PolicyCenter deletes the entity to which the <onetoone> element points if you delete this entity.

false

deprecated

If true, then PolicyCenter marks the item as deprecated in the Data Dictionary and places a Deprecated annotation on it in the Guidewire Studio API Reference.

If you deprecate an item, use the description to explain why.

For more information, see Data entity subelements.

false

desc

A description of the purpose and use of the field.

None

exportable

Unused.

fkentity

Required. The entity to which this foreign key points.

None

getterScriptability

See Data objects and scriptability for information.

all

ignoreForEvents

This attribute has complex, non-intuitive interactions with data entity relationships. See Interactions of ignoreForEvents attribute with data entity relationships for information on how to use and configure it.

Important: Do not confuse the definition of the ignoreForEvents attribute for the <onetoone> element with the definition of the attribute of the same namesake in <entity> and <array> elements. Although they share the same name, the two ignoreForEvents attributes are near opposites in effect.

false

linkField

Optional. Specifies the foreign key field that points back to this object.

None

name

Required. Specifies the name property on the entity.

None

nullok

Whether the field can contain null values.

true

owner

If true, this entity owns the linked object (the object to which the <onetoone> element points):

  • If you delete the owning object, then PolicyCenter deletes the linked object as well.
  • If you update the object pointed to by the <onetoone> element, then PolicyCenter considers the owning object updated as well.

false

setterScriptability

See Data objects and scriptability for information.

all

triggersValidation

Whether changes to the entity pointed to by this entity trigger validation.

false

Subelements of <onetoone>

The <onetoone> element contains the following subelements.

<onetoone>  subelement 

Description

Default

fulldescription

See <fulldescription>.

None

tag

See <tag>.

None