• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deleting object from list not being deleted in the database

 
Juzar Roopawalla
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have a one to many relationship defined in the following way:

<list name="timeEntryDetailsList" cascade="all-delete-orphan" lazy="false" >
<key column="timeEntryId" not-null="true"/>
<index column="idx"/>
<one-to-many class="com.msdw.pbefficiency.servicestracker.hibernate.pojo.TimeEntryDetails"/>
</list>

When I remove an object from my list using iterator.remove() and the call saveOrUpdate() the removed object still exists in the database. I thought all that was required was a cascade="all-delete-orphan" in the hbm, but this did not work. Any suggestions on why?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no "all-delete-orphan" There is an "all" and a "delete-orphan" and you can use both by seperating them with a comma.

"all, delete-orphan"

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic