Blog

Blog Archives - 2 Record(s)

Remove Filter Year: '2012' - Month: '1'

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

Posted by Luis Majano
Jan 17, 2012 22:17:25 UTC
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.

Presenting at the Houston User Group

Posted by Luis Majano
Jan 05, 2012 10:26:21 UTC
I am very excited to be lined up to present at the Houston User Group next week on our new project at Ortus Solutions, ContentBox.

For those of you who do not know what ContentBox is, here is a little insight.  ContentBox is our next major project here at Ortus Solutions, which is a highly modular content platform based on ColdBox architecture and modules.  It is a set ofColdBox modules that work in unison to provide you with blog, cms and development capabilities.  It is still in private alpha, but you can be part of it if you like by just requesting it: [email protected].  The major difference than traditional blogs or cms, is that ContentBox is highly extensible via ColdBox features and event driven programming.  You can easily extend it and create other modules that function outside of ContentBox with their own DI, caching, SES, or extend the content as well.

Site Updates

Archives

Entries Search