Question

In the Grails 1.2.5 project that I am trying to troubleshoot, we use the Grails Searchable plugin .5.5.1.

The problem is that whenever we attempt to index large sets domain classes, Grails keeps throwing:

ERROR hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: collection [domain-class] was not processed by flush()

But the domain classes involved have been mapped and used by hibernate without issues outside of the calls to searchable plugin.

The use of the searchable plugin goes as follows:

  1. Create a compass session with compass.openSession()
  2. Begin compass transaction: compassSession.beginTransaction()
  3. Then compassSession.create(result.get(0)) is called on an important unindexed domain class
  4. Finally compassTransaction.commit() is called to commit the transaction.
  5. Goto 2 and process next domain class

Between the 3 and 4th Domain class, an autoflush is triggered that throws the error.

Can anyone give me any hints about how to solve this problem?

Has anyone encountered this problem before?

I know that they had a systemic issue with this back in pre .5 versions of the searchable-plugin. Is it possible those issues weren't totally fixed?

Was it helpful?

Solution

This article helped me understand it. You must be doing some Hibernate querying in a session that has dirty objects, and they get flush()-ed in the middle of modification.

Sometimes it's possible to move all the read-only queries outside of transaction, before any modification occurs, and do modifications in withTransaction{}.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top