Chapter 17. Delete cascade

The class <table_name>DO.java provides java code for cascade delete of DOs.

The database that the application uses can support delete cascade. If supports, in its configuration file (in <dods_output>/build/conf directory) is the tag <DeleteCascade> set to true:

 <DeleteCascade>true</DeleteCascade>. 

If the database supports the delete cascade, the sql that handles delete cascade is generated. The java code in <table_name>DO.java class is always generated.

When delete cascade happens, if database supports delete cascade, the sql code is executed, the java code is not executed, and the cascade deleted DOs are marked as deleted.

If database does not support delete cascade, the sql code is neither generated, nor executed. The java code is executed, and cascade references are deleted.

Some database vendors (Microsoft SQLServer2000) have restrictions to delete cascade feature. Microsoft SQL Server 2000 support delete cascade only if there is no closed reference cycle between tables. Server will not allow creating reference cycle if they are set to delete cascade. In that case best solution is to set <DeleteCascade> tag to 'false', and leave DODS to do all delete cascade operation.