Esempio n. 1
0
 @Test
 public void testSelectWithFunction() throws SQLException {
   Query<Person> t1 = QB.create(Person.class);
   // 只选择指定的列
   t1.addCondition(new FBIField("MOD(age, 10)", t1), 2);
   t1.setCascade(false);
   List<Person> map = db.select(t1.getInstance());
 }
Esempio n. 2
0
 /**
  * 测试JpqlExpression表达式的使用
  *
  * @throws SQLException
  */
 @Test
 public void testExpression1() throws SQLException {
   System.out.println("=========== testExpression1 Start ==========");
   Query<Person> p = QB.create(Person.class);
   p.addCondition(
       new FBIField("upper(name)||str(age)", p), new JpqlExpression("upper(name)||'22'", p));
   List<Person> ps = db.select(p);
   assertTrue(ps.size() > 0);
   System.out.println("=========== testExpression1 End ==========");
 }