Hibernate/GORM: collection was not processed by flush()

早过忘川 提交于 2019-11-30 11:32:44

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.

I found a possible solution here.

Actually, look at toString, equals, hashcode and make sure you are not accessing your lazy accessor.

I know I am talking about java and here the question is about grails but maybe there is the same kind of thing for grails.

Don't hesitate to edit.

It was the issue for me (in java)

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

I had that error when a tried to add element to a collection after delete elements from the collection. I solved it by calling save(flush:true) before add new elements to the collection.

  • In my case, the collection is always returned from a select.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!