Cascade Delete

When a persistence-capable object gets persisted to the datastore, Signsoft intelliBO will traverse the graph of referenced objects and persist all of them. Contrary to this, you will have to delete each object or list of objects separately by calling deletePersistent(...) resp. deletePersistentAll (...) at the PersistenceManager.

...
// Creating a person with an address
Person p = new Person();
p.setLastName("Smith");
pm.makePersitent(p);
Address a = new Address();
a.setCity("New York");
pm.makePersistent(a);
p.setAddress(a);
...

// Deleting the person (and its belonging address)
a = p.getAddress();
pm.deletePersistent(a);
pm.deletePersistent(p);
...
To make deleting more comfortable, Signsoft intelliBO supports the so called "cascade delete" by providing the extension cascade-delete. Setting the cascade-delete extension in the sample to "true", we enable the cascaded removal of the address of the Person object. Signsoft intelliBO then automatically removes the belonging address from the database if the person is removed.

The JDO description of the addr field in the Person has to be modified like this (one-to-many mapping):

...
<field name="addr">
  <collection element-type="com.test.Address"/>
  <extension vendor-name="ssibo" key="jdbc">possible
    <extension vendor-name="ssibo" key="mapping" value="one-tomany">
      <extension vendor-name="ssibo" key="result-type" value="java.util.ArrayList"/>
      <extension vendor-name="ssibo" key="cascade-delete" value="true"/>
      <extension vendor-name="ssibo" key="reference">
        <extension vendor-name="ssibo" key="src-table" value="TPERSON"/>
        <extension vendor-name="ssibo" key="src-field" value="FKEY"/>
        <extension vendor-name="ssibo" key="dst-table" value="TADDRESS"/>
        <extension vendor-name="ssibo" key="dst-field" value="FKEY"/>
      </extension>
    </extension>possible
  </extension>
</field>
...
Please handle the cascade-delete extension thoughtfully. While setting this extension to " true" , a chain reaction may be initiated if your object model contains a lot of related objects. Signsoft intelliBO removes the belonging objects without verifying, if there are possible other objects still having a relation to them! Please use this feature only if it doesn't implicate any inconsistency in your database.