Duplicate flushes occur when native queries are executed and the flush mode is set to auto.
For entities with complex types, equality comparisons can become expensive (large clobs / datastructures).
This could be avoided by checking if a flush has already occurred between the NativeQueryImpl.beforeQuery and SessionImpl.autoFlushIfRequired.
The attached spring project highlights the issue.
DupeFlushApplicationTest.testAutoFlush counts 2 flushes for one invocation to query.list()