Exemplo n.º 1
0
  @Test
  public void testWhere2() {
    String hql = " from Customer c where c.age not between 20 and 40 ";
    Query query = session.createQuery(hql);
    List<Customer> customers = query.list();

    for (Customer c : customers) {
      System.out.println("name:" + c.getName());
      System.out.println("age:" + c.getAge());
    }
  }
Exemplo n.º 2
0
  @Test
  public void testOrderby() {
    String hql = " from Customer order by age desc ";
    Query query = session.createQuery(hql);
    List<Customer> customers = query.list();

    for (Customer c : customers) {
      System.out.println("name:" + c.getName());
      System.out.println("age:" + c.getAge());
    }
  }