- 当级联属性cascade="all"时,发现无法删除对一端的数据
- <set name="tripBusTravelSet" table="trip_bus_travel_depa_info" lazy="false" inverse="false"
- cascade="all" sort="unsorted">
- <key column="TRIP_BUS_TRAVEL_ID" />
- <one-to-many class="com.myway.followme.model.bus.TripBusTravelDepaInfo" />
- </set>
- 然后改成cascade="all-delete-orphan"时,可以实施级联删除
- <set name="tripBusTravelSet" table="trip_bus_travel_depa_info" lazy="false" inverse="false"
cascade="all-delete-orphan" sort="unsorted">
<key column="TRIP_BUS_TRAVEL_ID" />
<one-to-many class="com.myway.followme.model.bus.TripBusTravelDepaInfo" />
</set>
转载于:https://blog.51cto.com/zhangmin/587416