File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Android Security Essentials Live Lessons 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: 17249

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
I agree. Here's the link:
subject: Hibernate 2:Update objects which has List
Similar Threads
[Hibernate] Batch update returned unexpected row count
many-to-many relationship with annotation
How to avoid returng null object after deleting an object from the list collection?
[URLyBird] Should I use a business object or String[] in my Data class?
Hibernate Cache