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 delete .
Caution !
This setting will also trigger deletion of old member objects, on calls to 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 | cascadeOnDelete | delete | Using callbacks