cascade « Query « JPA Q&A





1. Hibernate, instrumentation and delete cascade order    stackoverflow.com

I have a complex object graph with JPA connected entities. When I delete the parent the deletions cascade correctly to the children. Then I instrument the parent class (as to not ...

2. Hibernate cascade "save-new-or-find-never-update", "delete-orphan"    stackoverflow.com

I have a simple person object with a one to many with an address. I want the address to be immutable so update=false on all of the fields. I ...

3. JPA need for explicit .refresh on Entity indepent of CascadeType.REFRESH?    stackoverflow.com

Why isn't my CascadeType.REFRESH actually refreshing my entities? When adding an object it doesn't update the collection (still empty). I need to explicit call entity.refresh()! Here's my partial code (where .ALL could ...

4. A question about HQL cascade select    coderanch.com

hi, everyone, i have a question for HQL we have two classes A and B, there have one-to-many relation, A is one, B is many. and B had a field x. question is: selected all the A's instance, required is B.x is equals 1. please give the HQL my answer is : FROM A a WHERE a.b.id in (SELECT b.id FROM ...

5. Problem with update query cascade    forum.hibernate.org

Hi, I have a parent class (maps child in a java.util.Set) and child bidirectional relationship. My understanding says that if I remove a child from the Set within the Parent, and call update on parent, the child will be deleted. I.e. Parent parent = session.getParent(Parent.class, Id); parent.setChildSet(new java.util.Set()); session.saveOrUpdate(parent); The above code should delete all the children associated with Parent. the ...

6. Cascading structure : how to select items ?    forum.hibernate.org

Let's consider an object : ObjectA { Long uid; ALogicalKey key; ALevel level; ObjectA parent; AnyType attribute1; AnyType attribute2; [...] } I can have several instances of ObjectA, linked each through the parent attribute. That's what I call my "cascading structure". Level is a value belonging to an ordered list. Let's imagine this suite : "VALUE1" -> "VALUE2" -> "VALUE3" -> ...

7. JPA - delete statement via Query and Cascade    forum.hibernate.org

Hi all I tried to use a delete statement via a query. Obviously it seems that the "Cascade" gets not recognized. It deletes only the parent object but not the child objects. Any Ideas why? Is this not supported or did I something wrong? When I do the same thing via the entityManager it works fine e.g. entityManager.remove(parent); Thanky oyu for ...

8. Refresh cascades to deleted objects    forum.hibernate.org

This is basically a post relating to an issue logged here. There hasn't been any progress made on the ticket in 4 years, so I thought I'd see if anyone has any advice. The situation involves two entity objects, in our case Bond and Coupons. Bond has a reference to Coupons, with Cascade.ALL set. In an effort to not have a ...

9. About the count of SQL statement when cascade="all"    forum.hibernate.org

I have a parent table named A, this table has two one-to-one relation to table B and table C. Firstly, I mapped this two one-to-one bidirectional relations with cascade="none", and when i insert 1000 columns into these three tables(call save() methods one bye one), the console displays three SQL statements. Finally, I change these two relations to cascade="all", but when i ...





10. Insertion Cascade Order when parent id is assigned    forum.hibernate.org

I have a class Survey with a many-to-one relationship "completionRewards" which I manage manually (no cascading). This one works fine. But I have another one "variables" which I would like to be managed automatically (cascade="all-delete-orphan"). If I create a new Survey(). Then do a couple addVariable() Then do session.save(survey). The order of insertion is wrong. It FIRST tries to insert the ...

11. Session.refresh() cascade behavior    forum.hibernate.org

Is there a way to force Session.refresh() to refresh child objects? I have a parent object that contains a bag of child objects, which each have a Clob. If I save the parent, then refresh(parent) and try to edit one of the children, I get the following error: java.lang.UnsupportedOperationException: Clob may not be manipulated from creating session. But... if I refresh(parent), ...

12. cascade="all-delete-orphan" with sort not working    forum.hibernate.org

I have a piece of code which has a set with a cascade="all-delete-orphan". But as soon as I add a sort="Comparator" the cascades stop working. The cross reference gets set to null and orphans are not deleted. It works fine without the sort on the set!?? I tried a work arround with the comparator in the setter or getter creating a ...

13. Order of cascaded deletes    forum.hibernate.org

Beginner Joined: Sun Feb 20, 2005 12:14 am Posts: 49 We have a Customer, Order and CreditCard. The mapping for these entities are below. 1. A CreditCard is always associated with a Customer. 2. An Order is always associated with a Customer. The problem: When we delete a Customer this cascades the delete to CreditCards and Orders the way we want ...

15. cascade deletion order problem    forum.hibernate.org

16. Problem with cascading refresh on object with collections    forum.hibernate.org

Newbie Joined: Tue Feb 21, 2006 3:37 am Posts: 2 I have a problem with cascading refresh on persistent objects with collections. I am working with: Hibernate version:3.1 I have an Object named Action and this object has a set with FunctionalAssociations in it. Mapping documents: act_id_seq Prefix ...





17. Hibernate Cascade Related Query    forum.hibernate.org

Hi All, I have three tables table1 table2 table3 The Primary key of Table1 and 3 are foreign keys in Table 2 In my mappings i have cascaded from table 1 to 2 ...and from table 3 to 2 Is there a way where all three tables can be saved by cascade in hibernate. If yes, please any reference links or ...

18. Order for cascading actions?    forum.hibernate.org

Hello, Happy new years 2008!!! After hollydays, a co-worker comes to me with a problem on cacasding and constraint violation. During the comit, the cascading (all-delete-orphan) try to insert before deleting the table row, so we run into a constraint violation (a dedicated unique constraint added on a table). Is it possible to force the cascading commands order? (so we can ...

19. Programatically find cascading properties    forum.hibernate.org

20. Is there a way to define the cascade order?    forum.hibernate.org

Hi all, Say I have the following public class Client { @OneToMany(mappedBy = "client", cascade = CascadeType.ALL) private List names = new ArrayList(); @OneToMany(mappedBy = "client", cascade = CascadeType.ALL) private List

addresses = new ArrayList
(); } Is there a way to tell hibernate to cascade 'names' first then 'addresses'? The cascade order is important as there're constraints in DB, if 'addresses' ...