@@ -269,7 +269,7 @@ public void testQuery01f() {
269
269
List <FullTimeEmployee > expected =
270
270
getTransientCompanyModelInstancesAsList (FullTimeEmployee .class , "emp1" , "emp2" , "emp5" );
271
271
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
272
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
272
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
273
273
q .filter (cand .salary .gt (30000. ));
274
274
List <FullTimeEmployee > emps = q .executeList ();
275
275
checkQueryResultWithoutOrder (ASSERTION_FAILED , SINGLE_STRING_QUERY_01 , emps , expected );
@@ -395,7 +395,7 @@ public void testQuery02f() {
395
395
List <FullTimeEmployee > expected =
396
396
getTransientCompanyModelInstancesAsList (FullTimeEmployee .class , "emp1" , "emp5" , "emp2" );
397
397
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
398
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
398
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
399
399
q .filter (cand .salary .gt (30000. )).orderBy (cand .salary .asc ());
400
400
List <FullTimeEmployee > emps = q .executeList ();
401
401
checkQueryResultWithOrder (ASSERTION_FAILED , SINGLE_STRING_QUERY_02 , emps , expected );
@@ -570,7 +570,7 @@ public void testQuery03f() {
570
570
List <FullTimeEmployee > expected =
571
571
getTransientCompanyModelInstancesAsList (FullTimeEmployee .class , "emp1" );
572
572
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
573
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
573
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
574
574
NumericExpression <Double > sal = q .numericParameter ("sal" , Double .class );
575
575
StringExpression begin = q .stringParameter ("begin" );
576
576
q .filter (cand .salary .gt (sal ).and (cand .firstname .startsWith (begin )));
@@ -735,7 +735,7 @@ public void testQuery04f() {
735
735
List <Employee > expected =
736
736
getTransientCompanyModelInstancesAsList (Employee .class , "emp1" , "emp2" , "emp3" );
737
737
try (JDOQLTypedQuery <Employee > q = pm .newJDOQLTypedQuery (Employee .class )) {
738
- QEmployee cand = QEmployee .candidate ();
738
+ QEmployee cand = QEmployee .candidate ("this" );
739
739
StringExpression dep = q .stringParameter ("dep" );
740
740
q .filter (cand .department .name .eq (dep ));
741
741
Map <String , Object > paramValues = new HashMap <>();
@@ -897,7 +897,7 @@ public void testQuery05f() {
897
897
List <Department > expected =
898
898
getTransientCompanyModelInstancesAsList (Department .class , "dept1" );
899
899
try (JDOQLTypedQuery <Department > q = pm .newJDOQLTypedQuery (Department .class )) {
900
- QDepartment cand = QDepartment .candidate ();
900
+ QDepartment cand = QDepartment .candidate ("this" );
901
901
QEmployee emp = QEmployee .variable ("emp" );
902
902
NumericExpression <Double > hours = q .numericParameter ("hours" , double .class );
903
903
q .filter (cand .employees .contains (emp ).and (emp .weeklyhours .gt (hours )));
@@ -1052,7 +1052,7 @@ public void testQuery06f() {
1052
1052
List <Department > expected =
1053
1053
getTransientCompanyModelInstancesAsList (Department .class , "dept1" , "dept2" , "dept3" );
1054
1054
try (JDOQLTypedQuery <Department > q = pm .newJDOQLTypedQuery (Department .class )) {
1055
- QDepartment cand = QDepartment .candidate ();
1055
+ QDepartment cand = QDepartment .candidate ("this" );
1056
1056
CollectionExpression <Collection <String >, String > depts =
1057
1057
q .collectionParameter ("depts" , String .class );
1058
1058
q .filter (depts .contains (cand .name ));
@@ -1199,7 +1199,7 @@ public void testQuery07f() {
1199
1199
tx .begin ();
1200
1200
List <String > expected = Arrays .asList ("Joe" , "Craig" , "Michael" );
1201
1201
try (JDOQLTypedQuery <Employee > q = pm .newJDOQLTypedQuery (Employee .class )) {
1202
- QEmployee cand = QEmployee .candidate ();
1202
+ QEmployee cand = QEmployee .candidate ("this" );
1203
1203
StringExpression deptName = q .stringParameter ("deptName" );
1204
1204
q .filter (cand .department .name .eq (deptName )).result (false , cand .firstname );
1205
1205
Map <String , Object > paramValues = new HashMap <>();
@@ -1354,7 +1354,7 @@ public void testQuery08f() {
1354
1354
tx .begin ();
1355
1355
List <Info > expected = testQuery08Helper ();
1356
1356
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
1357
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
1357
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
1358
1358
StringExpression deptName = q .stringParameter ("deptName" );
1359
1359
q .result (false , cand .firstname , cand .salary , cand .manager .as ("reportsTo" ))
1360
1360
.filter (cand .department .name .eq (deptName ));
@@ -1555,7 +1555,7 @@ public void testQuery09f() {
1555
1555
new Info ("Michael" , 40000. , getTransientCompanyModelInstance (Employee .class , "emp2" )),
1556
1556
new Info ("Craig" , 50000. , null ));
1557
1557
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
1558
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
1558
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
1559
1559
StringExpression deptName = q .stringParameter ("deptName" );
1560
1560
q .result (false , cand .firstname , cand .salary , cand .manager )
1561
1561
.filter (cand .department .name .eq (deptName ));
@@ -1707,7 +1707,7 @@ public void testQuery10f() {
1707
1707
tx .begin ();
1708
1708
Double expected = 45000. ;
1709
1709
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
1710
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
1710
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
1711
1711
StringExpression deptName = q .stringParameter ("deptName" );
1712
1712
q .result (false , cand .salary .avg ()).filter (cand .department .name .eq (deptName ));
1713
1713
Map <String , Object > paramValues = new HashMap <>();
@@ -1853,7 +1853,7 @@ public void testQuery11f() {
1853
1853
tx .begin ();
1854
1854
Double [] expected = new Double [] {45000. , 90000. };
1855
1855
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
1856
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
1856
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
1857
1857
StringExpression deptName = q .stringParameter ("deptName" );
1858
1858
q .result (false , cand .salary .avg (), cand .salary .sum ())
1859
1859
.filter (cand .department .name .eq (deptName ));
@@ -2020,7 +2020,7 @@ public void testQuery12f() {
2020
2020
tx .begin ();
2021
2021
Object [] expectedRow = new Object [] {45000. , 90000. , "R&D" };
2022
2022
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
2023
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
2023
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
2024
2024
q .result (false , cand .salary .avg (), cand .salary .sum (), cand .department .name )
2025
2025
.groupBy (cand .department .name )
2026
2026
.having (cand .department .name .count ().gt (1L ));
@@ -2167,7 +2167,7 @@ public void testQuery13f() {
2167
2167
tx .begin ();
2168
2168
Employee expectedEmp = getTransientCompanyModelInstance (Employee .class , "emp1" );
2169
2169
try (JDOQLTypedQuery <Employee > q = pm .newJDOQLTypedQuery (Employee .class )) {
2170
- QEmployee cand = QEmployee .candidate ();
2170
+ QEmployee cand = QEmployee .candidate ("this" );
2171
2171
StringExpression empName = q .stringParameter ("empName" );
2172
2172
q .filter (cand .firstname .eq (empName ));
2173
2173
Map <String , Object > paramValues = new HashMap <>();
@@ -2321,7 +2321,7 @@ public void testQuery14f() {
2321
2321
tx .begin ();
2322
2322
Double expectedSalary = 40000. ;
2323
2323
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
2324
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
2324
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
2325
2325
StringExpression empName = q .stringParameter ("empName" );
2326
2326
q .result (false , cand .salary ).filter (cand .firstname .eq (empName ));
2327
2327
Map <String , Object > paramValues = new HashMap <>();
@@ -2476,7 +2476,7 @@ public void testQuery15f() {
2476
2476
tx .begin ();
2477
2477
List <EmpWrapper > expected = testQuery15Helper ();
2478
2478
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
2479
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
2479
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
2480
2480
NumericExpression <Double > sal = q .numericParameter ("sal" , Double .class );
2481
2481
q .result (true , cand .as ("FullTimeEmployee" )).filter (cand .salary .gt (sal ));
2482
2482
Map <String , Object > paramValues = new HashMap <>();
@@ -2625,7 +2625,7 @@ public void testQuery16f() {
2625
2625
tx .begin ();
2626
2626
List <EmpInfo > expected = testQuery16Helper ();
2627
2627
try (JDOQLTypedQuery <FullTimeEmployee > q = pm .newJDOQLTypedQuery (FullTimeEmployee .class )) {
2628
- QFullTimeEmployee cand = QFullTimeEmployee .candidate ();
2628
+ QFullTimeEmployee cand = QFullTimeEmployee .candidate ("this" );
2629
2629
NumericExpression <Double > sal = q .numericParameter ("sal" , Double .class );
2630
2630
q .result (true , cand .as ("FullTimeEmployee" )).filter (cand .salary .gt (sal ));
2631
2631
Map <String , Object > paramValues = new HashMap <>();
@@ -2765,7 +2765,7 @@ public void testQuery17f() {
2765
2765
tx .begin ();
2766
2766
List <String > expected = Arrays .asList ("Michael" , "Craig" , "Joe" );
2767
2767
try (JDOQLTypedQuery <Department > q = pm .newJDOQLTypedQuery (Department .class )) {
2768
- QDepartment cand = QDepartment .candidate ();
2768
+ QDepartment cand = QDepartment .candidate ("this" );
2769
2769
QEmployee e = QEmployee .variable ("e" );
2770
2770
q .filter (cand .name .startsWith ("R&D" ).and (cand .employees .contains (e )))
2771
2771
.result (false , e .firstname );
@@ -2881,7 +2881,7 @@ public void testQuery18f() {
2881
2881
tx .begin ();
2882
2882
List <String > expected = Arrays .asList ("Michael" , "Craig" );
2883
2883
try (JDOQLTypedQuery <Employee > q = pm .newJDOQLTypedQuery (Employee .class )) {
2884
- QEmployee cand = QEmployee .candidate ();
2884
+ QEmployee cand = QEmployee .candidate ("this" );
2885
2885
JDOQLTypedSubquery <Employee > subquery = q .subquery ("e" );
2886
2886
QEmployee candsub = QEmployee .candidate ("e" );
2887
2887
q .result (false , cand .firstname )
@@ -3013,7 +3013,7 @@ public void testQuery19f() {
3013
3013
tx .begin ();
3014
3014
List <String > expected = Arrays .asList ("Michael" );
3015
3015
try (JDOQLTypedQuery <Employee > q = pm .newJDOQLTypedQuery (Employee .class )) {
3016
- QEmployee cand = QEmployee .candidate ();
3016
+ QEmployee cand = QEmployee .candidate ("this" );
3017
3017
JDOQLTypedSubquery <Employee > subquery =
3018
3018
q .subquery (cand .department .employees , Employee .class , "e" );
3019
3019
QEmployee candsub = QEmployee .candidate ("e" );
@@ -3146,7 +3146,7 @@ public String toString() {
3146
3146
builder .append ("EmpWrapper(" );
3147
3147
builder
3148
3148
.append ("FullTimeEmployee:" )
3149
- .append (FullTimeEmployee == null ? "null" : FullTimeEmployee .getFirstname ());
3149
+ .append (FullTimeEmployee == null ? "null" : "name = " + FullTimeEmployee .getFirstname ());
3150
3150
builder .append (")" );
3151
3151
return builder .toString ();
3152
3152
}
0 commit comments