Exemple #1
0
  @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());
    }
  }
Exemple #2
0
 @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);
   }
 }