예제 #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());
    }
  }
예제 #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());
    }
  }
예제 #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);
   }
 }