private Query makeQuery(Cache c) { QueryFactory qf = Search.getQueryFactory(c); return qf.from(Person.class) .having("age").gte(18) .build(); }
private Query makeQuery(Cache c) { QueryFactory qf = Search.getQueryFactory(c); return qf.from(Person.class) .having("age").gte(18) .build(); } }
public void testNotStoredProjection() { QueryFactory qf = getQueryFactory(); Query q = qf.from(getModelFactory().getTransactionImplClass()) .select("id", "description") .having("id").gte(98) .orderBy("id") .build(); List<Object[]> list = q.list(); assertEquals(2, list.size()); assertEquals(2, list.get(0).length); assertEquals(98, list.get(0)[0]); assertEquals("Expensive shoes 48", list.get(0)[1]); assertEquals(2, list.get(1).length); assertEquals(99, list.get(1)[0]); assertEquals("Expensive shoes 49", list.get(1)[1]); }
public void testNotIndexedProjection() { QueryFactory qf = getQueryFactory(); Query q = qf.from(getModelFactory().getTransactionImplClass()) .select("id", "isValid") .having("id").gte(98) .orderBy("id") .build(); List<Object[]> list = q.list(); assertEquals(2, list.size()); assertEquals(2, list.get(0).length); assertEquals(98, list.get(0)[0]); assertEquals(true, list.get(0)[1]); assertEquals(2, list.get(1).length); assertEquals(99, list.get(1)[0]); assertEquals(true, list.get(1)[1]); }
public void testNotIndexedOrderBy() { QueryFactory qf = getQueryFactory(); Query q = qf.from(getModelFactory().getTransactionImplClass()) .select("id", "isValid") .having("id").gte(98) .orderBy("isValid") .orderBy("id") .build(); List<Object[]> list = q.list(); assertEquals(2, list.size()); assertEquals(2, list.get(0).length); assertEquals(98, list.get(0)[0]); assertEquals(true, list.get(0)[1]); assertEquals(2, list.get(1).length); assertEquals(99, list.get(1)[0]); assertEquals(true, list.get(1)[1]); }
public void testNotStoredOrderBy() { QueryFactory qf = getQueryFactory(); Query q = qf.from(getModelFactory().getTransactionImplClass()) .select("id", "description") .having("id").gte(98) .orderBy("description") .orderBy("id") .build(); List<Object[]> list = q.list(); assertEquals(2, list.size()); assertEquals(2, list.get(0).length); assertEquals(98, list.get(0)[0]); assertEquals("Expensive shoes 48", list.get(0)[1]); assertEquals(2, list.get(1).length); assertEquals(99, list.get(1)[0]); assertEquals("Expensive shoes 49", list.get(1)[1]); }
break; case GREATER_OR_EQUAL: context = qb.having(sfilter.getFieldName()).gte(value); break; default:
public void testGte() { QueryFactory qf = getQueryFactory(); Query q = qf.from(getModelFactory().getTransactionImplClass()) .having("amount").gte(1500) .build(); List<Transaction> list = q.list(); assertEquals(2, list.size()); for (Transaction t : list) { assertTrue(t.getAmount() >= 1500); } }
/** * Using grouping and aggregation with continuous query is not allowed. */ @Test(expectedExceptions = ParsingException.class, expectedExceptionsMessageRegExp = ".*ISPN028509:.*") public void testDisallowGroupingAndAggregation() { Query query = Search.getQueryFactory(cache()).from(Person.class) .select(max("age")) .having("age").gte(20) .build(); ContinuousQuery<Object, Object> cq = Search.getContinuousQuery(cache()); cq.addContinuousQueryListener(query, new CallCountingCQResultListener<>()); }
/** * Using grouping and aggregation with event filters is not allowed. */ @Test(expectedExceptions = ParsingException.class, expectedExceptionsMessageRegExp = ".*ISPN028509:.*") public void testDisallowGroupingAndAggregation() { Query query = Search.getQueryFactory(cache(0)).from(Person.class) .having("age").gte(20) .select(max("age")) .build(); cache(0).addListener(new EntryListener(), Search.makeFilter(query), null); }
/** * Using grouping and aggregation with event filters is not allowed. */ @Test(expectedExceptions = ParsingException.class, expectedExceptionsMessageRegExp = ".*ISPN028509:.*") public void testDisallowGroupingAndAggregation() { Query query = Search.getQueryFactory(cache()).from(Person.class) .having("age").gte(20) .select(max("age")) .build(); cache().addListener(new EntryListener(), Search.makeFilter(query), null); }
.having("lastName").eq(Expression.param("nameParam2")) .or() .having("id").gte(Expression.param("idParam1")) .or() .having("id").lt(Expression.param("idParam2"))