jueves, 23 de agosto de 2012

Opciones de Cascada en Hibernate

Algo importante al utilizar las cascadas de hibernate en los hbm


  • none - do not do any cascades, let the users handles them by themselves. 
  • save-update - when the object is saved/updated, check the assoications and save/update any object that require it (including save/update the assoications in many-to-many scenario). 
  • delete - when the object is deleted, delete all the objects in the assoication. 
  • delete-orphan - when the object is deleted, delete all the objects in the assoication. In addition to that, when an object is removed from the assoication and not assoicated with another object (orphaned), also delete it. 
  • all - when an object is save/update/delete, check the assoications and save/update/delete all the objects found. 
  • all-delete-orphan - when an object is save/update/delete, check the assoications and save/update/delete all the objects found. In additional to that, when an object is removed from the assoication and not assoicated with another object (orphaned), also delete it.