parent:
Code:
<set name="children" lazy="true" inverse="true" cascade="delete">
...
child:
Code:
<many-to-one name="parent" class="Parent"/>
operation:
Code:
session.delete(parentObject);
session.flush();
After session.delete(), record in parent table is deleted,
but the child record is still there...why?hibernate generated sql:
Code:
Hibernate: delete from Parent where id=?
none of child delete script generated
Schema export:
Code:
alter table Child add index (parent), add constraint FK36A178A2F6669636 foreign key (parent) references Parent (id);
using MySQL 4, Hibernate 2.0.3