This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate 2:Update objects which has List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate 2:Update objects which has List" Watch "Hibernate 2:Update objects which has List" New topic

Hibernate 2:Update objects which has List

amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I try to persist object which has collection List .I have 2 tables .Everything is working fine but problem is that when i update the object then the original values does not delete but instead hibernate set the value of index column and foreign key null.I want that hibernate delete that row.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17271

You need to use cascade-option of "delete-orphan" in order for it to delete, if you use "delete" it just nulls out the Foreign Key.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
subject: Hibernate 2:Update objects which has List
It's not a secret anymore!