flushDirty() in custom interceptor triggered for non-changed entities when default_batch_fetch_size is set?

Hi there,
using Hibernate 5.3.4, I’m playing with “hibernate.default_batch_fetch_size”. To ensure some testing data integrity, I have integrated a test interceptor that extends from EmptyInterceptor and then throw some exceptions on invalid operations in flushDirty. Now, I found that when hibernate.default_batch_fetch_size is set to >1, some entities are processed in onFlushDirty which does not happen when no default_batch_fetch_size is set.

Is there already a logical explanation for this or is it worth providing some some code?

Best regards,
Niko

The onFlushDirty should be called if the entities were found dirty, meaning that an update is necessary.

If you spot a case when that does not happen, please provide a replicating test case as it might be a bug.

To me, it seems the other way around that a batch fetch size triggers flushDirty where it is not required. So this seems strange, so I try to provide a test case when I can spare time.

That’s worth investigating indeed. Thanks for taking your time and looking forward to your test case.