Blog

Category Filtering: 'orm'

Remove Filter


Couchbase NoSQL Replication ColdFusion ORM

Posted by Luis Majano
31 Jul 2013 10:03 PM

We just published part II of our integrating Couchbase NoSQL with ColdFusion series which focuses on Couchbase replication, XDCR, failovers and an intro to secondary caches for Hibernate: Check it out:

https://www.ortussolutions.com/blog/couchbase-cluster-setup-orm-secondary-cache-introduction

CF ORM – A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance

Posted by Luis Majano
17 Jan 2012 10:17 PM
Have you experienced this incredibly odd error using ColdFusion ORM:

HibernateException – A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance

This is really cryptic and most likely you have a parent to child relationship and you are most likely wiping or wanting to wipe all the references of the child.  We usually can do this via:

// wipe out the children

parent.setChildren( [] )

We then proceed to maybe put more children into the collection:

parent.addChild( objX );

parent.addChild( objY );

// Now save

transaction{

entitySave( parent );

}

This is where you get that magical Hibernate error. The issue is that the existing collection is now de-referenced, you completely wiped it so Hibernate has no clue what to do with it. So to resolve this, just clear the collection instead and voila!

// use java

parent.getChildren().clear();

// or use CF

arrayClear( parent.getChildren() );

That's it, this tells Hibernate that the collection is removed first and then you added some more children.

Site Updates

Entries Search