Be careful when you use Hibernate’s support for database ON DELETE CASCADE constraint. If not configured properly, your application might be more performance-costly than you think.
Let me use the example from Gavin King’s email introducing the new setting of on-delete=”cascade”:
<set name="children" inverse="true" cascade="all"> <key name="PARENT_ID" on-delete="cascade"> <one -to-many class="Child"> <set>
For a parent object associated with N child objects (cascade=”all”), the setting on-delete=”cascade” avoids issuing N deletes to the database if the parent were to be deleted.