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