guidewire

Cascade delete for one-to-one mapping (guidewire custom entity linked to Document)


<entity  
  entity="ABC_Ext"  
  desc="SAMPLE ENTITY"  
  table="sampleentity_ext"  
  type="retireable">

  <foreignkey 
    fkentity="Job" 
    name="Job" 
    nullok="false" />

  <foreignkey
    fkentity="Document"
    name="Document"
    nullok="false" />

  <implementsEntity
    name="Extractable"/>

  <implementsEntity
    name="FrozenSetMember"/>
</entity>

This entity (ABC_Ext) has a foreign key reference to Job and Document. It’s essentially a one-to-one mapping to the Document entity.

When I delete a Document, the corresponding ABC_Ext record is not deleted automatically.

I know that cascade delete is available for arrays in Guidewire, but I’m not sure if something similar exists for one-to-one mappings via a foreign key.

My questions:

Does Guidewire provide any built-in functionality to automatically delete a child entity (like ABC_Ext) when the parent (Document) is deleted?

Is there a generic configuration or pattern (similar to cascade delete) to handle this for one-to-one mappings, or do I have to do it programmatically (e.g., via a rule/event)?

Any examples or best practices would be appreciated.


Solution

  • The parent entity (Document, in this case) should be extended with a one-to-one reference to your custom child entity. The one-to-one component includes an optional cascadeDelete attribute that will signal that the child should be deleted when the parent Document is removed.

    Adding this one-to-one property is a legal data model change. It is a logical change only (similar to declaring an array) so it won't change the physical data model.

    Here's a link to the documentation for reference (requires login).