If I have one parent and its two children and delete orphan is on and if I remove one child of the parent and then persist it, hibernate should delete one child from the database. But hibernate just runs the update query, no delete query and both the children remains in the database. Do you have any idea, what could be the possible reasons behind that? Thanks in advance.
Asked
Active
Viewed 310 times
1 Answers
0
I think the problem is something with hibernate object states. When you are doing within the persistent state hibernate will run the update query. Best thing is get the object and run session.delete().

Karesh A
- 1,731
- 3
- 22
- 47
-
I think, instead of updating parent object, fetch child object separately and then call session.delete() on child object as said by @Karesh Arunakirinathan – Rahul Agrawal Jun 29 '12 at 06:05