I want to delete record(s) from child table after calling save/update on parent using hibernate
views:
15answers:
1
+1
Q:
I want to delete record(s) from child table after calling save/update on parent using hibernate
+1
A:
Using an interceptor or callbacks methods would probably be the best place to implement this. I'm not sure if you are using straight Hibernate or JPA so I'll provide both links:
- Chapter 12. Interceptors and events in Hibernate Core Reference Guide
- Chapter 6. Entity listeners and Callback methods in Hibernate EM Reference Guide
Basically, the idea would be to set the child collection to null during pre-update.
Pascal Thivent
2010-07-29 07:18:53