UserPageRepository

/**
* It has the functions of paging and sorting and inherits CrudRepository
*/
public interface UserPageRepository extends PagingAndSortingRepository {
}
1
2
3
4
5
UserPageRepositoryTests:

@RunWith(SpringRunner.class)
@SpringBootTest
public class UserPageRepositoryTests {

@Autowired
private UserPageRepository userPageRepository;

/**
* Sort query
*/
@Test
public void findAllBySort () {
List userList = (List) userPageRepository.findAll(new Sort(Sort.Direction.ASC, “age”));
System.out.println(userList.size( ));
System.out.println(userList);
}

/**
* Paging query
*/
@Test
public void findAllByPageable() {
Page userPage = userPageRepository.findAll(new PageRequest(0, 20));
userPage.getNumber();//Number of pages
userPage.getContent();// Pagination data
userPage.getTotalPages();//Total number of pages
System.out.println(“number:” + userPage.getNumber(http://www.amjmh.com/v/BIBRGZ_558768/ )
+ “Countet” + userPage.getContent().size()
+ “TotalPages” + userPage.getTotalPages());
}

}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2794 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.