cascade « Data Type « JPA Q&A





1. Hibernate - how to set null value so that cascading worked [interesting!]?    stackoverflow.com

I'm talking about a detached object, that later I want to update with saveOrUpdate(). How can we at the same time set null and clear() a referenced collection? A [1:1] B [1:M] C B ...

2. cascade save in hibernate, foregin key is saved as null    stackoverflow.com

I have a class as follows

class A{
 Set<B> = new HashSet<B>();

}

class B{
  A a;

}
Now primary key of A is autogenerated so i cant set it before in A or B.B ...

4. Hibernate - Getting null exception during delete cascade    coderanch.com

Hi I have two objects. Offering is parent while OfferingMessage is child. Offering has a list of OfferingMessages. Following is how I am defining my Offering and OfferingMessage classes. Offering Class package com.shahkaar.domain; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; ...

5. JPA: Transient References not resolved by Cascade    forum.hibernate.org

Hi all, this issue is probably extremly obvious and/or stupid, but I just can't figure it out. I got a small project with two Entites, below is the condensed code: Code: @Entity @Table(name="GAMES") public class GameEntity extends JavaEntity{ ..... @Column(name="GAME_TEAM1", nullable=false) @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) ...

6. CollectionOfElements and cascade delete    forum.hibernate.org

Hi! I have a bean property with following annotations: @CollectionOfElements(fetch = FetchType.EAGER) @JoinTable(name = "DICT_ITEM_EXT_ATTR") @org.hibernate.annotations.Fetch(value = org.hibernate.annotations.FetchMode.SUBSELECT) @Column(length = 4000) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.TRANSACTIONAL) public Map getExtAttributes() { return extAttributes; } When I try to delete the owner of this map, i get java.sql.SQLException: ORA-02292: integrity constraint (DIRECT.DICITEMEXATT_DICT_ITEMS_FK) violated - child record found If I remove fetch = FetchType.EAGER it ...

7. Enable Cascade - On delete set null    forum.hibernate.org

Hi everyone! Is it possible to set a cascade type on a Collection to set child field to null when a parent is deleted. I'll give you an example. I get two object : Classification and Taxo. Classification is the parent and Taxo, the child. A Taxo don't have to get any Classification. (so it's a "not-null=false"). My mapping is ok ...

8. Cascade set null    forum.hibernate.org

...

9. Getting null exception during delete cascade    forum.hibernate.org

Newbie Joined: Thu Jun 10, 2010 7:26 pm Posts: 2 Hi I have two objects. Offering is parent while OfferingMessage is child. Offering has a list of OfferingMessages. Following is how I am defining my Offering and OfferingMessage classes. Offering Class Code: package com.shahkaar.domain; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import ...





10. Cascade save and Unidirectional navigability - FK not null    forum.hibernate.org

I have run into an issue where I would like to force navigability a certain way per our requirements. I do this as follows: Table A is a parent of Table B and B has a FK to A that is set to NOT NULL. This is a 1:M relationship respectively. In Hibernate, I have Object A with a Set of ...

11. CASCADE SET NULL:deleted object would be re-saved by cascade    forum.hibernate.org

I have two losely coupled objects. Currently I use lifecycle methods (onDelete) to perform an 'on cascade set null' operation. But there should be a more elegant way, shouldn't it? I use an unordinary Category and Product scenario for demonstration but in real I need it for some other relations. By deleteing the category containing the product, the product should remain ...

12. Cascade of set element type = string does not occur    forum.hibernate.org

Author Message jbevan Post subject: Cascade of set element type = string does not occur Posted: Fri Aug 27, 2004 3:09 am Newbie Joined: Wed Aug 04, 2004 4:16 pm Posts: 12 Location: UCSC Hi all, I seem to have come across a point where what I see in the hibernate source code and what I understand from Chapter ...

13. Howto avoid a lazy init when key=null (cascade=true) ?    forum.hibernate.org

Hibernate version:2.1.6 Mapping documents: ------- Move -------

15. Problem with cascading Oracle CLOBs    forum.hibernate.org

We are using Lukasz's "Updated Clobs handling for Oracle and Hibernate" solution and experiencing a problem. The table which contains the CLOB is working fine. However, we are using this table cascaded from another table and it randomly fails to insert to the parent table. Let me illustrate what I mean...

16. Cascade delete with not null column    forum.hibernate.org

Newbie Joined: Wed Jan 19, 2005 11:10 am Posts: 4 Location: Brazil Hi, I'm trying to do a cascade delete in a many-to-one relation using the native feature from Hibernate. The feature was working fine before I set the foreign-key in child to not-null. After this, I had see the Hibernate is doing a update in child, setting the parent's foreign-key ...





17. Thorny equals/hashCode problem involving cascades    forum.hibernate.org

As recommended in HIA and the reference docs, my objects implement equals and hashCode using 'business key equality', or 'the natural key I would be using if I wasn't using surrogate keys'. This means that they exclude the identifier property (because that breaks sets on save in the well understood way), but they do sometimes include the identifier properties of their ...

18. Cascade delete causes timestamp update on parent    forum.hibernate.org

Author Message jweinstock Post subject: Cascade delete causes timestamp update on parent Posted: Tue Dec 06, 2005 2:14 pm Newbie Joined: Sat Nov 05, 2005 3:10 pm Posts: 2 We are experiencing an issue where, when we perform a delete on a parent object, the delete operation causes an update stmt to be issued against the database when the ...

19. Cascade save() -> "the given object has a null ident    forum.hibernate.org

This is the simple Parent/Child problem. Both Parent and Child have pk as Integer id I need to create/insert a Parent along with many children in same time Code: Parent parent = new Parent("Parent"); parent.addChild( new Child("First") ) parent.addChild( new Child("Second") ) session.save( parent ) where addChild is bi-directional parent is set in child Parent mapping Code: ...

20. Null Pointer with Cascading merges on SortedSet Comparator    forum.hibernate.org

Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message pants Post subject: Null Pointer with Cascading merges on SortedSet Comparator Posted: Fri Jun 16, 2006 12:51 pm Newbie Joined: Tue Jan 04, 2005 9:30 am Posts: 5 I'm having a strange issue with cascading merges ...

21. UserType and cascade    forum.hibernate.org

Hi, i've implemented a UserType to do some custom persitence and it works nicely. However, the item that is persisted using this type holds onto objects that are persisted using the normal Hibernate mapping approach. So my referenced objects aren't getting persisted. How do I cascade? I have this sort of thing: I want to add ...

22. Howto cascade on delete=set null?    forum.hibernate.org

23. NPE when removing cascaded transient instances    forum.hibernate.org

Hi, I just hit an NPE which will happen when removing cascaded transient instances. Here are the relevant code lines from the code stack below: Code: DefaultDeleteEventListener.java:183: if ( transientEntities.contains( entity ) ) { DefaultDeleteEventListener.java:81: deleteTransientEntity( source, entity, event.isCascadeDeleteEnabled(), persister, transientEntities ); SessionImpl.java:775: ...

24. Null values and Cascade deleting    forum.hibernate.org

25. On delete cascade / set null    forum.hibernate.org

26. Setting null with cascade="delete-orphan"?    forum.hibernate.org

27. Many-to-one with cascade="none" AND null values    forum.hibernate.org

Hi Guys, I have a small problem with many-to-one relationship. I have a table called inputs which has many-to-one relationship with a table called webpages, now an input can either have a webpage or a null value, i can save it in the database in either case but when i try to delete an input with null webpage value it throws ...

28. two cascading paths - null or transient value exception    forum.hibernate.org

Should I expect some intelligence from Hibernate when an object can be reached through two paths: an all-cascading and a non-cascading association path? I would expect that Hibernate notices that the object should be persisted, but this doesn't seem to be the case. I also didn't find any guarantee in the EJB3.0 specification. Here is an example: I have a parent ...