@Test public void Enum_Binding() { List<Cat> cats = query().from(cat).select(Projections.bean(Cat.class, QCat.cat.color)).fetch(); assertFalse(cats.isEmpty()); for (Cat cat : cats) { assertEquals(Color.BLACK, cat.getColor()); } }
@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); } }