Unidirectional « Delete « JPA Q&A





1. JPA: unidirectional many-to-one and cascading delete    stackoverflow.com

Say I have a unidirectional @ManyToOne relationship like the following:

@Entity
public class Parent implements Serializable {

    @Id
    @GeneratedValue
    private long id;
}

@Entity
public class Child ...

2. Problems with deleting objects in unidirectional 1:N rel.    forum.hibernate.org

Hi, I have problems with deleting objects. First my mappings (my questions are below..):

3. Cascading delete of unidirectional relationship    forum.hibernate.org

The metadata would have to be attached to other side in a kind of an inverse-cascade property. I don't have any idea how the internals of Hibernate work but it would obviously require the creation of some sort of listener for the delete of an A objects. Or it would require the session searching for non directly associated relationships with the ...

4. Deleting from unidirectional many-to-many    forum.hibernate.org

Hibernate version: 3:0 Name and version of the database you are using:PostgreSql 8 Hi. I have class Person with a Set friends which is unidirectional many-to-many to Person. class Person { ... /** * @hibernate.set * table="FRIENDS_OF_PERSONS" * lazy="true" * cascade="none" * @hibernate.collection-key * column="HAVE_A_FRIEND" * @hibernate.collection-many-to-many * class="com.polatach.model.Person" * column="IS_A_FRIEND" */ public Set getFriends() { return friends; } ... } ...

5. Deleting problem with many-to-many unidirectional associatio    forum.hibernate.org

Hi , I have following entries in the hbm.xml mapping file.

6. deleting an entity in unidirectional many-to-many assoc.    forum.hibernate.org

message -> group unidirectional many-to-many As expected, deleting a group must result removing of the corresponding entries in its association table with message. Since there is no way to navigate from group back to the messages it is referenced, to implement the functionality is the only way to find all messages having sets including to-be-deleted group and update their set and ...

7. Delete orphan record with unidirectional one-to-one    forum.hibernate.org

I can't get Hibernate to perform deletion of an orphan record in my unidirectional one-to-one association. I have a test case that: - gets a disconnected "Parent" object - nullifies the "child" attribute - updates the "Parent". After which the Parent FK to Child is null, but the orphaned record still exists in the Child table. This would work if it ...

8. Cascade Delete problem using a unidirectional asscoiation    forum.hibernate.org

Thanks in advance Sagi... but that can be done even without using Hibernate using DDL statements. My question is how do I define such a relationship in the Hibernate mapping file. Has nobody come across this problem as of now..or can someone provide me links to applications that have successfully defined such a relationship. -Poonam.





10. delete not propagated to join table in unidirectional 1-*    forum.hibernate.org

EDIT: updated subject to better match problem description Hello, I'm using Hibernate as a JPA provider and encounter the following problem. I've been reading documentation, and forum for hours bit still didn't find anything. I have a unidirectional one-to-many relation with delete-orphan cascading. I use the hbm2ddl script to genenerate the tables. This gives me 2 tables for the entities and ...