boycod3 boycod3 - 1 year ago 96
Java Question

How to use spring Page without spring data

Hi i'm using below code for find article using spring with plain hibernate.

public List<Article> getArticles(int currPosition, int pageSize) {
Criteria c = getSession().createCriteria(Article.class);
List<Article> result = c.list();
return result;

i'm not using spring data in my project now, So how can i use
with my project.

Page<Person> persons = personService.findAllPageable(new PageRequest(evalPage, evalPageSize));

Answer Source

You can use Pageable#getSize to set maxResults, Pageable#getOffset for setFirstResult and Pageable#getSort to obtain sorting parameters.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download