File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Author

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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate 2:Update objects which has List
 
Similar Threads
many-to-many relationship with annotation
Hibernate Cache
[URLyBird] Should I use a business object or String[] in my Data class?
How to avoid returng null object after deleting an object from the list collection?
[Hibernate] Batch update returned unexpected row count