<xml> </xml>

db4o |

# ObjectClass.CascadeOnDelete Method

sets cascaded delete behaviour.

void CascadeOnDelete(
bool flag
);

#### Parameters

flag
  whether deletes are to be cascaded to member objects.

#### Remarks

sets cascaded delete behaviour.
Setting cascadeOnDelete to true will result in the deletion of all member objects of instances of this class, if they are passed to com.db4o.ObjectContainer.Delete .
Caution !
This setting will also trigger deletion of old member objects, on calls to com.db4o.ObjectContainer.Set .
An example of the behaviour:

                ObjectContainer con;

                Bar bar1 = new Bar();

                Bar bar2 = new Bar();

                foo.bar = bar1;

                con.set(foo);  // bar1 is stored as a member of foo

                foo.bar = bar2;

                con.set(foo);  // bar2 is stored as a member of foo

The last statement will also delete bar1 from the ObjectContainer, no matter how many other stored objects hold references to bar1.
The default setting is false.

#### See Also

ObjectClass Interface | com.db4o.config Namespace | com.db4o.config.ObjectField.CascadeOnDelete | com.db4o.ObjectContainer.Delete | Using callbacks