[hibernate-dev] Native query and auto-flush

Guillaume Smet guillaume.smet at gmail.com
Thu Oct 30 09:44:14 EDT 2014


Starting with HHH-8487, when we execute a native query, an auto-flush
is executed (and might be limited with addSynchronizedEntityClass and

While I understand the rationale of this change, we are having a few
issues with this when the transaction opened is read-only which is the
case for all our read-only queries: Hibernate tries to flush the dirty
entities in a read-only transaction and fails.

The heart of the issue here is that we have dirty entities which
shouldn't be dirty (see my post on embedded and dirtiness) but I'm
wondering if it's a behavior which was missed by this patch or
something intentional. So I thought I might as well report it.


More information about the hibernate-dev mailing list