| 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 ) { // 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 |