views:

621

answers:

3

Hi,

I have an integration test in my Grails application that fails when I try to save an entity of type Member

invitingMember.save(flush: true)

This raises the following exception

org.hibernate.AssertionFailure: collection [com.mycompany.facet.Facet.channels] was not processed by flush() at com.mycompany.member.MemberConnectionService.addOrUpdateContact(MemberConnectionService.groovy:939)

Earlier in the transaction I add a Facet to a collection. My guess is that the exception is thrown at the line above, because it's only at this point that the Facet is persisted, and "something goes wrong" with saving/flushing the channels collection property of the Facet.

Cheers, Don

+1  A: 

The underlying problem is probably that Hibernate doesn't cascade the save. So when you flush the Member, Hibernate notices that the collection is still dirty (which is probably not what you want). So either flush the collection manually or tell Hibernate to cascade all the updates.

Aaron Digulla
I'm pretty sure that when using GORM (the ORM used by Grails that is built "on top of" Hibernate) saves are cascaded by default.
Don
A: 

Can you post your original test as well as the domain objects involved?

Dean Del Ponte
A: 

The only time I've encountered that exeception is when using Hibernate events e.g. beforeInsert, beforeUpdate etc - are you using these?

There's an issue in JIRA related to this which has been fixed for Grails 1.2

leebutts
No, I'm not using any events
Don