Archive for the performance tuning Category

Hibernate ‘on-delete=cascade’ Performance Tuning

Posted in hibernate, java, performance tuning on November 16, 2006 by eddie

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">

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.

Continue reading