elasticsearch-grails-plugin
elasticsearch-grails-plugin copied to clipboard
Hibernate session's flushMode set to FlushMode.MANUAL unexpectedly
Hi, guys.
Nice plugin, very useful, thank you for it!
I had taken a look at #15 issue, and was happy to see that some issues with hibernate sessions were resolved, but it seems not all of them.
I have elasticsearch-grails-plugin up-to-date taken from your repo. When I try to save any item to database and then to remove it via my "admin UI", an exception is thrown after calling delete operation. Here's the message:
Message: Write operations are not allowed in read-only mode (FlushMode.MANUAL):
Turn your Session into flushMode.COMMIT/AUTO or remove 'readOnly'
marker from transaction definition.
This error is thrown only when plugin is enabled. As a workaround, which prevents this weird exception:
Domain.withTransaction {
domain.delete(flush: true)
}
But it's not pretty, is it? Appreciate any help! Is it a hibernate bug, or another plugin's session management bug?
this is a weird phenomena. I use a Filter to set each session.setFlushMode(FlushMode.AUTO).
or do sessin.flush in filter' afterView closure.