Skip to content

Commit 2c6a2f8

Browse files
author
teck
committed
use addCriteria()
1 parent 7f5d953 commit 2c6a2f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/sharrissf/sample/EhcacheSearchPlaying.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void runTests() throws IOException {
9393

9494
Query query = cache.createQuery();
9595
query.includeKeys();
96-
query.add(name.like("Ari*").and(gender.eq(Gender.MALE)))
96+
query.addCriteria(name.like("Ari*").and(gender.eq(Gender.MALE)))
9797
.addOrder(age, Direction.ASCENDING).maxResults(10);
9898

9999
long t = System.currentTimeMillis();
@@ -142,7 +142,7 @@ public void runTests() throws IOException {
142142
.println("Find the average age of all people between 30 and 40");
143143

144144
Query agesBetween = cache.createQuery();
145-
agesBetween.add(age.between(30, 40));
145+
agesBetween.addCriteria(age.between(30, 40));
146146
agesBetween.includeAggregator(Aggregators.average(age));
147147
System.out.println("Average age between 30 and 40: "
148148
+ agesBetween.execute().getAggregatorResults());
@@ -151,7 +151,7 @@ public void runTests() throws IOException {
151151

152152
System.out.println("Find the count of people from NJ");
153153

154-
Query newJerseyCountQuery = cache.createQuery().add(state.eq("NJ"));
154+
Query newJerseyCountQuery = cache.createQuery().addCriteria(state.eq("NJ"));
155155
newJerseyCountQuery.includeAggregator(Aggregators.count());
156156
System.out.println("Count of people from NJ: "
157157
+ newJerseyCountQuery.execute().getAggregatorResults());

0 commit comments

Comments
 (0)