Exemple #1
0
 @Test
 public void testExample() {
   Cat example = new Cat("grey", new Cat("black"));
   assertEquals(
       "this.color = :color and 1 = 1 and :kitten_0 in elements(this.kitten)",
       HqlUtils.getExampleWhereClause(Cat.class, example, "this", "color", "kitten"));
 }
Exemple #2
0
 @Test
 public void searchWhereClauseWith2Dots() {
   assertEquals(
       "((foo_bar is not null and lower(str(foo_bar.baz)) like :search))",
       HqlUtils.getSearchWhereClause("this", "search", "foo.bar.baz"));
 }
Exemple #3
0
 @Test
 public void joinsForSearchWithoutDot() {
   StringBuilder hql = new StringBuilder();
   HqlUtils.appendJoinsForSearch(hql, "this", "foo");
   assertEquals("", hql.toString());
 }
Exemple #4
0
 @Test
 public void searchWhereClauseWithoutDot() {
   assertEquals(
       "((lower(str(this.foo)) like :search))",
       HqlUtils.getSearchWhereClause("this", "search", "foo"));
 }
Exemple #5
0
 @Test
 public void joinsForSearchWith2Dots() {
   StringBuilder hql = new StringBuilder();
   HqlUtils.appendJoinsForSearch(hql, "this", "foo.bar.baz");
   assertEquals(" left join this.foo.bar as foo_bar", hql.toString());
 }