| The current pagination follows the Ask Tom guidelines, and, if we apply the current patch, we break the follow-on-locking mechanism as well. I modified the test case and showed that if you compare the pages against a larger page which selects all comparing pages, then everything works as expected:
List<RootEntity> rootEntitiesAllPages = getLimitedRows( entityManager, 0, 10 );
List<RootEntity> rootEntitiesFirst = getLimitedRows( entityManager, 0, 5 );
List<RootEntity> rootEntitiesSecond = getLimitedRows( entityManager, 5, 10 );
assertEquals( rootEntitiesAllPages.get( 0 ).getId(), rootEntitiesFirst.get( 0 ).getId() );
assertEquals( rootEntitiesAllPages.get( 1 ).getId(), rootEntitiesFirst.get( 1 ).getId() );
assertEquals( rootEntitiesAllPages.get( 2 ).getId(), rootEntitiesFirst.get( 2 ).getId() );
assertEquals( rootEntitiesAllPages.get( 3 ).getId(), rootEntitiesFirst.get( 3 ).getId() );
assertEquals( rootEntitiesAllPages.get( 4 ).getId(), rootEntitiesFirst.get( 4 ).getId() );
assertEquals( rootEntitiesAllPages.get( 5 ).getId(), rootEntitiesSecond.get( 0 ).getId() );
assertEquals( rootEntitiesAllPages.get( 6 ).getId(), rootEntitiesSecond.get( 1 ).getId() );
assertEquals( rootEntitiesAllPages.get( 7 ).getId(), rootEntitiesSecond.get( 2 ).getId() );
assertEquals( rootEntitiesAllPages.get( 8 ).getId(), rootEntitiesSecond.get( 3 ).getId() );
assertEquals( rootEntitiesAllPages.get( 9 ).getId(), rootEntitiesSecond.get( 4 ).getId() );
Now, comparing it against getAllRows will fail for one row, but from the status column alone, both sets are ordered. If you want to match the ordering for those two, you need to provide more filtering criteria and then the pages will align. For the moment, I'm going to reject this change. |