@Test
public void testQueryObject() throws Exception {

    PersonDefinition p = Person.PERSON;
    for (int j = 0; j < TABLE_MODE; j++) {
        SqlBuilder builder = selectAllFrom(p).where(p.PeopleID.eq(j+1)).into(Person.class);
        Person pk = dao.queryObject(builder);
        assertNotNull(pk);
        assertEquals(j+1,  pk.getPeopleID().intValue());
        assertEquals("test",  pk.getName());
    }
    
    SqlBuilder builder = selectCount().from(p).intoObject();
    Number n = dao.queryObject(builder);
    assertEquals(4, n.longValue());
    
    for (int j = 0; j < TABLE_MODE; j++) {
        builder = selectAllFrom(p).where(p.PeopleID.eq(j+1)).into(Person.class).withLock();
        Person pk = dao.queryObject(builder);
        assertNotNull(pk);
        assertEquals(j+1,  pk.getPeopleID().intValue());
        assertEquals("test",  pk.getName());
    }
    
    builder = selectCount().from(p).intoObject().withLock();
    n = dao.queryObject(builder);
    assertEquals(4, n.longValue());
}