using spring-data-commons-core 1.0.0.BUILD-SNAPSHOT
with spring-data-jpa 1.0.0.BUILD-SNAPSHOT
data :
test :Code:INSERT INTO User ( username, lastname) VALUES ( 'usr_1', 'Matthews'); INSERT INTO User ( username, lastname) VALUES ( 'usr_2', 'Matthews'); INSERT INTO User ( username, lastname) VALUES ( 'usr_3', 'Matthews'); INSERT INTO User ( username, lastname) VALUES ( 'usr_4', 'Matthews'); INSERT INTO User ( username, lastname) VALUES ( 'usr_5', 'Matthews'); INSERT INTO User ( username, lastname) VALUES ( 'usr_6', 'Matthews'); INSERT INTO User ( username, lastname) VALUES ( 'usr_7', 'Beauford'); INSERT INTO User ( username, lastname) VALUES ( 'usr_8', 'Lassard');
result:Code:@BeforeTransaction public void setupData() throws Exception { if (countRowsInTable("User") == 0) { executeSqlScript("classpath:data.sql", false); } logger.info("rows:"+countRowsInTable("User")); } @Test public void testAllPages(){ Page<User> page = repository.findByLastname("Matthews", new PageRequest(0, 2)); logger.info(page); logger.info(page.getContent()); while(page.hasNextPage()){ page = repository.findByLastname("Matthews", new PageRequest(page.getNumber()+1, 2)); logger.info(page); logger.info(page.getContent()); } }
the count query does not use "findByLastname"Code:RepositoryTest - rows:8 RepositoryTest - Page 0 of 4 containing org.wims.data.model.User instances RepositoryTest - [User[1:usr_1], User[2:usr_2]] RepositoryTest - Page 1 of 4 containing org.wims.data.model.User instances RepositoryTest - [User[3:usr_3], User[4:usr_4]] RepositoryTest - Page 2 of 4 containing org.wims.data.model.User instances RepositoryTest - [User[5:usr_5], User[6:usr_6]] RepositoryTest - Page 3 of 4 containing UNKNOWN instances RepositoryTest - []
could not find this problem in the issues


Reply With Quote