Package com.github.dactiv.orm.core

Examples of com.github.dactiv.orm.core.PageRequest


    assertEquals(user.getUsername(),"maurice");
  }

  @Test
  public void testSearchUserPage() {
    PageRequest request = new PageRequest();
   
    List<PropertyFilter> filters = Lists.newArrayList(
        PropertyFilters.get("LIKES_username", "es"),
        PropertyFilters.get("EQI_state", "1")
    );
View Full Code Here


    assertEquals(user.getId(), "SJDK3849CKMS3849DJCK2039ZMSK0003");
  }

  @Test
  public void testFindPage() {
    PageRequest request = new PageRequest();
    request.setOrderBy("loginName,realName,state,id");
    request.setOrderDir(Sort.ASC + "," + Sort.DESC + "," +Sort.ASC + "," + Sort.DESC);
   
    Page<User> page = new Page<User>(request);
   
    Criteria c = sessionFactory.getCurrentSession().createCriteria(User.class);
   
    page = userDao.findPage(request, c.add(Restrictions.eq("loginName", "maurice")));
    assertEquals(page.getTotalItems(), 1);
    assertEquals(page.getTotalPages(), 1);
   
    List<PropertyFilter> filters = Lists.newArrayList(
        PropertyFilters.get("LIKES_loginName", "m"),
        PropertyFilters.get("EQI_state", "1")
    );
   
    page = userDao.findPage(request, filters);
    assertEquals(page.getTotalItems(), 5);
    assertEquals(page.getTotalPages(), 1);
   
    page = userDao.findPage(request, "from User u where u.loginName like ?", "%m%");
    assertEquals(page.getTotalItems(), 5);
    assertEquals(page.getTotalPages(), 1);

    Query query = sessionFactory.getCurrentSession().createQuery("from User u where u.loginName like ?1");
    query.setParameter("1", "%m%");
   
    page = userDao.findPage(request, query);
    assertEquals(page.getTotalItems(), 5);
    assertEquals(page.getTotalPages(), 1);

    page = userDao.findPage(request, "from User u where u.loginName like ?1", "%m%");
    assertEquals(page.getTotalItems(), 5);
    assertEquals(page.getTotalPages(), 1);
   
    request.setOrderBy(null);
    request.setOrderDir(null);
   
    page = userDao.findPage(request, "QueryUserMenuJpa","SJDK3849CKMS3849DJCK2039ZMSK0001",1);
    assertEquals(page.getTotalItems(), 8);
    assertEquals(page.getTotalPages(), 1);
   
View Full Code Here

    assertEquals(afterRow, beforeRow - 2);
  }
 
  @Test
  public void testSearchDataDictionary() {
    PageRequest request = new PageRequest();
   
    List<PropertyFilter> filters = Lists.newArrayList(
        PropertyFilters.get("LIKES_type", "S")
    );
   
View Full Code Here

TOP

Related Classes of com.github.dactiv.orm.core.PageRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.