Assertion error in org.hibernate.engine.internal.BatchFetchQueueHelper


Hi there,

using Hibernate 5.2.16, I’m encountering an assertion error in org.hibernate.engine.internal.BatchFetchQueueHelper#removeNotFoundBatchLoadableEntityKeys

assert idSet.size() == ids.length - results.size();

a) when bytecode enhancement is disabled
b) in Hibernate Search with enabled bytecode enhancement.

Is there a usual suspect I can track down this?
While debugging the assertion, I can see this:

As results show ambigous results, might this be related to an incorrect hashcode/equals implementation?



From the image, it looks like the results ArrayList have a duplicated User@14158 while the ids are deduplicated.

Try to provide a replicating test case.


Providing a test case will be quite tricky. But I’ve just found out that this only happens when AvailableSettings.DEFAULT_BATCH_FETCH_SIZE is set. Not using batch fetches does not cause this issue.


Without a test case that proves the issue, it’s not clear what exactly is not working properly and requires a fix.


Of course. I will tackle this issue ASAP.