remove « Delete « JPA Q&A





1. What is the difference between REMOVE and DELETE?    stackoverflow.com

Is there a difference between :

  • @Cascade(org.hibernate.annotations.CascadeType.REMOVE) and
  • @Cascade(org.hibernate.annotations.CascadeType.DELETE) ?

2. 2 problems with removing objects in hibernate    stackoverflow.com

I use Hibernate and I try to delete parent object using cascade property These are my two java classes: Address(parent) and Student(child)

public class Address implements java.io.Serializable {

    private long ...

3. Delete elements from one-to-many relationships when removing them from a JPA Entity    stackoverflow.com

I am using JPA (Hibernate) with the following entity class with one one-to-many relationship. When I add elements to the list, and then persist the Organization entity, it adds the new elements ...

4. Can't get delete orphan to remove the orphan from the db    forum.hibernate.org

Newbie Joined: Tue Jun 14, 2011 6:01 pm Posts: 1 Using Hibernate 3.3.2 with annotations 3.4.0. I'm having trouble with cascade delete orphan not working for one particular setup. Other entities in my code base are working just fine. It's the following that isn't working for some reason. I'm just guessing it may have something to do with the fact that ...

6. coll of obj refs: delete obj, how to to remove coll entry ?    forum.hibernate.org

tenwit, tenwit wrote: So long as there are no in-memory instances of the parent, then it happens automatically. If the parent is in memory (even in Hibernate's cache), you'll have to refresh it (session.evict(parent) will do the job, as will session.refresh(parent)). Sorry, but I do not think I follow - what does this have to do with the state of the ...

7. removing objects from associative set on delete()    forum.hibernate.org

Let's use the example of departments within a company. A particular employee can be a member of more than one department. So, I have a unidirectional many-to-many association where each department contains a set of employees. When an employee is deleted, I want him deleted from any department(s) that he may be associated with. This is resulting in an "integrity constraint ...

9. Cannot delete database rows: using Iterator.remove()    forum.hibernate.org

There is no need to save the object when you remove any element from that object's collection. what you have done is removed the element using iterator.remove(). Thats it. You just need to commit your transaction and the corresponding elelemnt will get deleted from the database. I have implemented this. It works fine at my end. Vishal





10. removing entity from all collections on delete: for review    forum.hibernate.org

Newbie Joined: Tue Mar 24, 2009 1:46 am Posts: 1 I am trying to work out a robust way to remove a child entity from all collections on entity delete to ensure all related collection cache nodes in 2nd level cache are properly evicted. In doing so I came up with a solution below, which I hope someone can validate (please ...