There is an assertion in the removeNotFoundBatchLoadableEntityKeys method of the BatchFetchQueueHelper class that seems to be wrong[1]. This error can make test cases fail unexpectedly.
When reaching this method having the results list with a size lower than the ids array (Because the ids array has duplicated values: this can happen when using the padding fetch style), then the assertion can fail.
I think that the ids.length is not the size to check in the assertion. Proposed solution:
Set<Serializable> idSet = new HashSet<>( Arrays.asList( ids ) ); *int setOfIdsSize = idSet.size();* for ( Object result : results ) { \n // All results should be in the PersistenceContext idSet.remove( session.getContextEntityIdentifier( result ) ); } // assert idSet.size() == ids.length - results.size(); *assert idSet.size() == setOfIdsSize - results.size();*
[1- BatchFetchQueueHelper Wrong Assertion|https://github.com/hibernate/hibernate-orm/blob/86f310e4cb2ab48b4ad9f9d327a172b08b86281f/hibernate-core/src/main/java/org/hibernate/engine/internal/BatchFetchQueueHelper.java#L61] |
|