Search in sources :

Example 1 with PaginHandler

use of com.github.drinkjava2.jsqlbox.handler.PaginHandler in project jSqlBox by drinkjava2.

the class HandlersTest method testPaginHandler.

@Test
public void testPaginHandler() {
    List<Map<String, Object>> result = ctx.nQuery(new Wrap(new EntitySqlMapListHandler(DemoUser.class), new PaginHandler(2, 5)), "select u.** from DemoUser u where u.age>?", 0);
    Assert.assertTrue(result.size() == 5);
    List<DemoUser> users = ctx.nQuery(new Wrap(new EntityListHandler(DemoUser.class), new PaginHandler(2, 5)), "select u.** from DemoUser u where u.age>?", 0);
    Assert.assertTrue(users.size() == 5);
}
Also used : PaginHandler(com.github.drinkjava2.jsqlbox.handler.PaginHandler) Wrap(com.github.drinkjava2.jdbpro.handler.Wrap) EntityListHandler(com.github.drinkjava2.jsqlbox.handler.EntityListHandler) Map(java.util.Map) EntitySqlMapListHandler(com.github.drinkjava2.jsqlbox.handler.EntitySqlMapListHandler) Test(org.junit.Test)

Example 2 with PaginHandler

use of com.github.drinkjava2.jsqlbox.handler.PaginHandler in project jSqlBox by drinkjava2.

the class HandlersTest method testHandlers.

@Test
public void testHandlers() {
    List<DemoUser> result = ctx.nQuery(new Wrap(PrintSqlHandler.class, new EntityListHandler(DemoUser.class), new PaginHandler(1, 5), PrintSqlHandler.class), "select u.** from DemoUser u where u.age>?", 0);
    Assert.assertTrue(result.size() == 5);
}
Also used : PaginHandler(com.github.drinkjava2.jsqlbox.handler.PaginHandler) Wrap(com.github.drinkjava2.jdbpro.handler.Wrap) EntityListHandler(com.github.drinkjava2.jsqlbox.handler.EntityListHandler) PrintSqlHandler(com.github.drinkjava2.jdbpro.handler.PrintSqlHandler) Test(org.junit.Test)

Aggregations

Wrap (com.github.drinkjava2.jdbpro.handler.Wrap)2 EntityListHandler (com.github.drinkjava2.jsqlbox.handler.EntityListHandler)2 PaginHandler (com.github.drinkjava2.jsqlbox.handler.PaginHandler)2 Test (org.junit.Test)2 PrintSqlHandler (com.github.drinkjava2.jdbpro.handler.PrintSqlHandler)1 EntitySqlMapListHandler (com.github.drinkjava2.jsqlbox.handler.EntitySqlMapListHandler)1 Map (java.util.Map)1