Hibernate version: 2.1.6
In Hibernate one can have cascading operations *from parent to children* (some entity manages its lists, sets, maps or other child entites).
We have a mapping file "Schedule.hbm.xml" where every Schedule is bound to House, Flat and so on:
...
<many-to-one name="house" class="House" column="house_id" not-null="false" cascade="none"/>
...
In this relation the parent is Schedule and children are House, Flat etc.
This relation (from Schedule to other entites) is not cascading:
When a Schedule is deleted, Houses, Flats and other entites which were referenced from Schedule will not be deleted. Only the Schedule will be deleted.
But we need another kind of cascading:
When a House or Flat etc. is being deleted, all Schedules which have a link to this House or Flat must be deleted as well.
So we are looking for an elegant way to do this. Didnt find anything in the Docs though so I hope someone can help me ehre!
Thanks in advacne
MVeeck
|