/**
* Test method.
* @throws Exception For any exception thrown.
*/
public void testNamedQuery() throws Exception {
Database db = _category.getDatabase();
// load all EntityOne instances using a named query
db.begin();
OQLQuery query = db.getNamedQuery(SELECT_ALL_ENTITY_ONE);
QueryResults results = query.execute();
int i = 0;
while (results.hasMore()) {
NQEntity entity = (NQEntity) results.next();
assertNotNull(entity);
i++;
}
assertTrue(i >= ENTITY_COUNT);
db.commit();
// load EntityOne with Id=1 from persistent store
db.begin();
query = db.getNamedQuery(SELECT_ENTITY_ONE_BY_ID);
query.bind(new Integer(0));
results = query.execute();
NQEntity entity = (NQEntity) results.next();
assertNotNull(entity);
assertEquals(new Integer(0), entity.getId());
db.commit();
db.close();
}