19 package testsuite.clusterj;
21 import testsuite.clusterj.model.Employee;
22 import com.mysql.clusterj.query.QueryBuilder;
23 import com.mysql.clusterj.query.QueryDomainType;
24 import com.mysql.clusterj.query.Predicate;
25 import com.mysql.clusterj.query.PredicateOperand;
26 import com.mysql.clusterj.Query;
27 import java.util.HashSet;
28 import java.util.List;
35 createSessionFactory();
38 createEmployeeInstances(10);
43 }
catch (Throwable t) {
56 tableScanEqualQuery();
57 tableScanGreaterEqualQuery();
58 tableScanGreaterThanQuery();
59 tableScanLessEqualQuery();
60 tableScanLessThanQuery();
63 public void tableScanEqualQuery() {
83 query.setParameter(
"name",
"Employee number 8");
85 List<Employee> results = query.getResultList();
87 consistencyCheck(results);
89 errorIfNotEqual(
"Wrong employee id returned from equal query: ",
90 8, results.get(0).getId());
94 public void tableScanGreaterThanQuery() {
103 PredicateOperand param = dobj.param(
"name");
105 PredicateOperand column = dobj.get(
"name");
107 Predicate compare = column.greaterThan(param);
114 query.setParameter(
"name",
"Employee number 6");
118 consistencyCheck(results);
126 actual.add(emp.getId());
128 errorIfNotEqual(
"Wrong employee ids returned from greaterThan query: ",
133 public void tableScanGreaterEqualQuery() {
142 PredicateOperand param = dobj.param(
"name");
144 PredicateOperand column = dobj.get(
"name");
146 Predicate compare = column.greaterEqual(param);
153 query.setParameter(
"name",
"Employee number 7");
157 consistencyCheck(results);
165 actual.add(emp.getId());
167 errorIfNotEqual(
"Wrong employee ids returned from greaterEqual query: ",
172 public void tableScanLessThanQuery() {
181 PredicateOperand param = dobj.param(
"name");
183 PredicateOperand column = dobj.get(
"name");
185 Predicate compare = column.lessThan(param);
192 query.setParameter(
"name",
"Employee number 3");
196 consistencyCheck(results);
204 actual.add(emp.getId());
206 errorIfNotEqual(
"Wrong employee ids returned from lessThan query: ",
211 public void tableScanLessEqualQuery() {
220 PredicateOperand param = dobj.param(
"name");
222 PredicateOperand column = dobj.get(
"name");
224 Predicate compare = column.lessEqual(param);
231 query.setParameter(
"name",
"Employee number 2");
235 consistencyCheck(results);
243 actual.add(emp.getId());
245 errorIfNotEqual(
"Wrong employee ids returned from lessEqual query: ",