@Test public void EntityQueries() { QCat catEntity = QCat.cat; List<Cat> cats = query().from(cat).orderBy(cat.name.asc()).select(catEntity).fetch(); assertEquals(6, cats.size()); for (Cat c : cats) { assertNotNull(c.getName()); } }
@Test @Ignore public void EntityProjections() { List<Cat> cats = query() .from(cat) .orderBy(cat.name.asc()) .select(Projections.constructor(Cat.class, cat.name, cat.id)) .fetch(); assertEquals(6, cats.size()); for (Cat c : cats) { assertNotNull(c.getName()); assertTrue(c.getId() > 0); } }