join « Delete « JPA Q&A





1. Hibernate: delete orphan from Join Table    stackoverflow.com

I have two persistent classes. They are are in many-to-many relationship. One class have a set of objects of another class. @Entity class A { @Id @Generated int id; ...

2. Hibernate: Bulk delete on join table?    coderanch.com

Is it not possible to reduce the number of delete statements or was my problem description too short? No matter if I used a HQL query or a Criteria, I always ended with two delete statements whereas I'm looking for something which results in this kind of SQL: 'delete from JoinTable where idA in (select id from A where... )' I ...

3. hql delete join    coderanch.com

Hi, I am able to delete records from a single table. But when i try to delete from multiple tables using joins Hiberate throws Exception: Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpecte d token: , near line 1, column 31 My Query: " delete from org.hib.Table1 t1,org.hib.Table2 t2 where ta.id = t2.id and t2.name=name " Can you please tell me how to ...

4. cascade delete join    forum.hibernate.org

I have table A and B, which are joined in table C. If A or B is deleted I want the relations in C deleted but not the object (A or B) it was related to. Can I use cascade for this, if yes how, or do I have to delete the relation in C manually?

5. Join table deletion problem    forum.hibernate.org

I'm a beginner in Hibernate and I have the following problem. I have one entity class called User. Each user can have a supervisor which is also an instance of User, and a set of subordinates which are User instances as well. I use a helper table called "supervisors_subordinates" to persist supervisor-subordinate pairs. Here is the XML mapping of the entity ...

6. deleting from join table    forum.hibernate.org

Hello: I am using hibernate2.jar. What I want to do is to delete from a join table a single row. I have a many to many relationship between table ap_step and technology. The join table is ap_step_technology. Here's the mapping for each object. For brevity I am including only the portion of interest: ApStepVO.hbm.xml

7. Stopping deletes from join table    forum.hibernate.org

8. Bulk delete on join table?    forum.hibernate.org

9. Preventing deletion of join table rows on delete    forum.hibernate.org

This might sound silly, but I want to prevent Hibernate from trying to delete join table rows of a many-to-many relation when deleting an entity - we have read-only relations that are realized as views in the DB (joining two entities through a complex query), not as physical join tables, hence attempting to delete those rows throws an error. Is there ...





10. many-to-many: delete only one object and the row in the join    forum.hibernate.org

Hi all. I have this scenario: i have two entities: OrganoRub and NominativoRub; the relation between them is many to many...that is an OrganoRub can have from 0 to infinite NominativoRub and viceversa a NominativoRub can have from 0 to infinite OrganoRub. Besides i need that when i create an OrganoRub and this OrganoRub has a non persisted NominativoRub associated this ...

11. auto delete many2many join records    forum.hibernate.org

Hibernate Version 3.2.5.ga w\ JPA I have a ManyToMany association between 2 entities A & B. When I associate an A to a B a record is automatically created in the the join table. When I unassociate an A from a B the record is automatically removed from the the join table. This is all fine. However, if I just try ...

12. HQL delete with inner joins?    forum.hibernate.org

13. Join Table cascade delete    forum.hibernate.org

OK, I have setup a scenaior previously where if I remove the relationship of a parent it will delete that child. That was a choir but with your good help I got it. Now I have a more difficult situation. I have parent child relationship, however it was modeled as such. The database was modeled for many to many with join ...

14. Unable to delete many to many join table data-JPA{Hibernate}    forum.hibernate.org

Hi - I am using EJB3 + JPA {Hibernate 3} on Weblogic10 App server and have been facing the following problem: - A)Table User --------------- UserID PK UserName B)Table Role --------------- RoleID PK RoleName C)Table UserRole {composite PK} -------------- UserID (PK) RoleID (PK) UserRoleCreateDate I have 3 Entities corresponding to these 3 tables. And their relationship is as follows: - A) ...