Search in sources :

Example 1 with EntityNetHandler

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

the class HandlersTest method testEntityNetHandler.

@Test
public void testEntityNetHandler() {
    EntityNet net = ctx.nQuery(new EntityNetHandler(DemoUser.class), "select u.** from DemoUser u where u.age>?", 0);
    List<DemoUser> result = net.getAllEntityList(DemoUser.class);
    Assert.assertTrue(result.size() == 99);
}
Also used : EntityNet(com.github.drinkjava2.jsqlbox.entitynet.EntityNet) EntityNetHandler(com.github.drinkjava2.jsqlbox.handler.EntityNetHandler) Test(org.junit.Test)

Example 2 with EntityNetHandler

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

the class EntityNetDemoTest method testEntityNetQuery.

@Test
public void testEntityNetQuery() {
    insertDemoData();
    EntityNet net = ctx.nQuery(new EntityNetHandler(User.class, Email.class), "select u.**, e.** from usertb u, emailtb e where u.id=e.userId");
    Assert.assertEquals(8, net.size());
    Set<Email> emails = net.findEntitySet(Email.class, new Path(User.class).where("id='u1' or id='u2'").autoPath(Email.class));
    Assert.assertEquals(4, emails.size());
}
Also used : Path(com.github.drinkjava2.jsqlbox.entitynet.Path) User(com.github.drinkjava2.functionstest.entitynet.entities.User) Email(com.github.drinkjava2.functionstest.entitynet.entities.Email) EntityNet(com.github.drinkjava2.jsqlbox.entitynet.EntityNet) EntityNetHandler(com.github.drinkjava2.jsqlbox.handler.EntityNetHandler) Test(org.junit.Test)

Aggregations

EntityNet (com.github.drinkjava2.jsqlbox.entitynet.EntityNet)2 EntityNetHandler (com.github.drinkjava2.jsqlbox.handler.EntityNetHandler)2 Test (org.junit.Test)2 Email (com.github.drinkjava2.functionstest.entitynet.entities.Email)1 User (com.github.drinkjava2.functionstest.entitynet.entities.User)1 Path (com.github.drinkjava2.jsqlbox.entitynet.Path)1