Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate 2:Update objects which has List  RSS feed

 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!