cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abulat...@apache.org
Subject [cayenne] branch master updated: CAY-2378 Switch usage of SelectQuery to ObjectSelect internally
Date Mon, 12 Aug 2019 14:05:51 GMT
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new d4773da  CAY-2378 Switch usage of SelectQuery to ObjectSelect internally
d4773da is described below

commit d4773daf340b789be28600d060cacb85ee6ac99e
Author: Arseni Bulatski <ancarseni@gmail.com>
AuthorDate: Mon Aug 12 17:05:36 2019 +0300

    CAY-2378 Switch usage of SelectQuery to ObjectSelect internally
---
 .../cayenne/access/DataContextArrayTypeIT.java     |  9 ++++----
 .../cayenne/access/DataContextBinaryPKIT.java      |  4 ++--
 .../apache/cayenne/access/DataContextBlobIT.java   | 24 +++++++++++-----------
 .../apache/cayenne/access/DataContextClobIT.java   | 22 ++++++++++----------
 .../DataContextEJBQLNumericalFunctionalIT.java     | 11 ++++------
 .../access/DataContextQualifiedEntityIT.java       | 17 ++++++++-------
 .../cayenne/access/DataContextQueryChainIT.java    |  5 +++--
 .../cayenne/access/DataContextValidationIT.java    | 18 +++++++---------
 .../org/apache/cayenne/access/DeleteObjectIT.java  | 13 ++++++------
 .../access/FlattenedRelationshipInContextIT.java   | 10 ++++-----
 .../access/NestedDataContext_DeadlockIT.java       |  8 ++++----
 .../org/apache/cayenne/access/ObjectStoreGCIT.java |  6 +++---
 .../cayenne/access/VerticalInheritanceIT.java      |  4 ++--
 13 files changed, 72 insertions(+), 79 deletions(-)

diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextArrayTypeIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextArrayTypeIT.java
index aa6c764..4f78f70 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextArrayTypeIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextArrayTypeIT.java
@@ -19,16 +19,16 @@
 
 package org.apache.cayenne.access;
 
+import java.util.List;
+
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.testdo.array_type.ArrayTestEntity;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Test;
 
-import java.util.List;
-
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertNotNull;
 
@@ -47,7 +47,8 @@ public class DataContextArrayTypeIT extends ServerCase {
         arrayTest.setDoubleArray(doubleArray);
         context.commitChanges();
 
-        List<ArrayTestEntity> res = context.performQuery(new SelectQuery(ArrayTestEntity.class));
+        List<ArrayTestEntity> res = ObjectSelect.query(ArrayTestEntity.class)
+                .select(context);
         ArrayTestEntity arrayRes = res.get(0);
 
         assertNotNull(arrayRes);
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBinaryPKIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBinaryPKIT.java
index b091db9..8b9e998 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBinaryPKIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBinaryPKIT.java
@@ -21,7 +21,7 @@ package org.apache.cayenne.access;
 
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.testdo.binary_pk.BinaryPKTest1;
 import org.apache.cayenne.testdo.binary_pk.BinaryPKTest2;
 import org.apache.cayenne.unit.UnitDbAdapter;
@@ -76,7 +76,7 @@ public class DataContextBinaryPKIT extends ServerCase {
             context.commitChanges();
             context.invalidateObjects(master, detail);
 
-            BinaryPKTest2 fetchedDetail = new SelectQuery<>(BinaryPKTest2.class).select(context1).get(0);
+            BinaryPKTest2 fetchedDetail = ObjectSelect.query(BinaryPKTest2.class).selectFirst(context);
             assertNotNull(fetchedDetail.readPropertyDirectly("toBinaryPKMaster"));
 
             BinaryPKTest1 fetchedMaster = fetchedDetail.getToBinaryPKMaster();
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBlobIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBlobIT.java
index 9933450..fb671ca 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBlobIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextBlobIT.java
@@ -19,9 +19,11 @@
 
 package org.apache.cayenne.access;
 
+import java.util.List;
+
 import org.apache.cayenne.access.types.ByteArrayTypeTest;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.testdo.lob.BlobTestEntity;
 import org.apache.cayenne.unit.UnitDbAdapter;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
@@ -29,8 +31,6 @@ import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Test;
 
-import java.util.List;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
@@ -48,7 +48,7 @@ public class DataContextBlobIT extends ServerCase {
 
     @Inject
     private UnitDbAdapter accessStackAdapter;
-    
+
     protected boolean skipTests() {
         return !accessStackAdapter.supportsLobs();
     }
@@ -76,7 +76,7 @@ public class DataContextBlobIT extends ServerCase {
         }
 
         // read the CLOB in the new context
-        List<BlobTestEntity> objects2 = context2.select(new SelectQuery<BlobTestEntity>(BlobTestEntity.class));
+        List<BlobTestEntity> objects2 = ObjectSelect.query(BlobTestEntity.class).select(context2);
         assertEquals(3, objects2.size());
     }
 
@@ -129,7 +129,7 @@ public class DataContextBlobIT extends ServerCase {
 
         // read the BLOB in the new context
 
-        List<?> objects2 = context2.performQuery(new SelectQuery(BlobTestEntity.class));
+        List<?> objects2 = ObjectSelect.query(BlobTestEntity.class).select(context2);
         assertEquals(1, objects2.size());
 
         BlobTestEntity blobObj2 = (BlobTestEntity) objects2.get(0);
@@ -140,13 +140,13 @@ public class DataContextBlobIT extends ServerCase {
         context2.commitChanges();
 
         // read into yet another context and check for changes
-        List<?> objects3 = context3.performQuery(new SelectQuery(BlobTestEntity.class));
+        List<?> objects3 = ObjectSelect.query(BlobTestEntity.class).select(context3);
         assertEquals(1, objects3.size());
 
         BlobTestEntity blobObj3 = (BlobTestEntity) objects3.get(0);
         ByteArrayTypeTest.assertByteArraysEqual(blobObj2.getBlobCol(), blobObj3
                 .getBlobCol());
-      
+
     }
 
     protected void runWithBlobSize(int sizeBytes) throws Exception {
@@ -163,10 +163,10 @@ public class DataContextBlobIT extends ServerCase {
         context.commitChanges();
 
         // read the CLOB in the new context
-        List<?> objects2 = context2.performQuery(new SelectQuery(BlobTestEntity.class));
+        List<BlobTestEntity> objects2 = ObjectSelect.query(BlobTestEntity.class).select(context2);
         assertEquals(1, objects2.size());
 
-        BlobTestEntity blobObj2 = (BlobTestEntity) objects2.get(0);
+        BlobTestEntity blobObj2 = objects2.get(0);
         ByteArrayTypeTest.assertByteArraysEqual(blobObj1.getBlobCol(), blobObj2
                 .getBlobCol());
 
@@ -177,10 +177,10 @@ public class DataContextBlobIT extends ServerCase {
         context2.commitChanges();
 
         // read into yet another context and check for changes
-        List<?> objects3 = context3.performQuery(new SelectQuery(BlobTestEntity.class));
+        List<BlobTestEntity> objects3 = ObjectSelect.query(BlobTestEntity.class).select(context3);
         assertEquals(1, objects3.size());
 
-        BlobTestEntity blobObj3 = (BlobTestEntity) objects3.get(0);
+        BlobTestEntity blobObj3 = objects3.get(0);
         ByteArrayTypeTest.assertByteArraysEqual(blobObj2.getBlobCol(), blobObj3
                 .getBlobCol());
     }
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextClobIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextClobIT.java
index 4e3cb1b..5e8431c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextClobIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextClobIT.java
@@ -19,8 +19,10 @@
 
 package org.apache.cayenne.access;
 
+import java.util.List;
+
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.testdo.lob.ClobTestEntity;
 import org.apache.cayenne.unit.UnitDbAdapter;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
@@ -28,8 +30,6 @@ import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Test;
 
-import java.util.List;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
@@ -99,10 +99,10 @@ public class DataContextClobIT extends ServerCase {
         context.commitChanges();
 
         // read the CLOB in the new context
-        List<?> objects2 = context2.performQuery(new SelectQuery(ClobTestEntity.class));
+        List<ClobTestEntity> objects2 = ObjectSelect.query(ClobTestEntity.class).select(context2);
         assertEquals(1, objects2.size());
 
-        ClobTestEntity clobObj2 = (ClobTestEntity) objects2.get(0);
+        ClobTestEntity clobObj2 = objects2.get(0);
         assertNull("Expected null, got: '" + clobObj2.getClobCol() + "'", clobObj2
                 .getClobCol());
 
@@ -111,10 +111,10 @@ public class DataContextClobIT extends ServerCase {
         context2.commitChanges();
 
         // read into yet another context and check for changes
-        List<?> objects3 = context3.performQuery(new SelectQuery(ClobTestEntity.class));
+        List<ClobTestEntity> objects3 = ObjectSelect.query(ClobTestEntity.class).select(context3);
         assertEquals(1, objects3.size());
 
-        ClobTestEntity clobObj3 = (ClobTestEntity) objects3.get(0);
+        ClobTestEntity clobObj3 = objects3.get(0);
         assertEquals(clobObj2.getClobCol(), clobObj3.getClobCol());
     }
 
@@ -137,10 +137,10 @@ public class DataContextClobIT extends ServerCase {
         context.commitChanges();
 
         // read the CLOB in the new context
-        List<?> objects2 = context2.performQuery(new SelectQuery(ClobTestEntity.class));
+        List<ClobTestEntity> objects2 = ObjectSelect.query(ClobTestEntity.class).select(context2);
         assertEquals(1, objects2.size());
 
-        ClobTestEntity clobObj2 = (ClobTestEntity) objects2.get(0);
+        ClobTestEntity clobObj2 = objects2.get(0);
         assertEquals(clobObj1.getClobCol(), clobObj2.getClobCol());
 
         // update and save Clob
@@ -148,10 +148,10 @@ public class DataContextClobIT extends ServerCase {
         context2.commitChanges();
 
         // read into yet another context and check for changes
-        List<?> objects3 = context3.performQuery(new SelectQuery(ClobTestEntity.class));
+        List<ClobTestEntity> objects3 = ObjectSelect.query(ClobTestEntity.class).select(context3);
         assertEquals(1, objects3.size());
 
-        ClobTestEntity clobObj3 = (ClobTestEntity) objects3.get(0);
+        ClobTestEntity clobObj3 = objects3.get(0);
         assertEquals(clobObj2.getClobCol(), clobObj3.getClobCol());
     }
 }
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
index c4383af..10db03c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
@@ -19,14 +19,15 @@
 
 package org.apache.cayenne.access;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.List;
+
 import org.apache.cayenne.Cayenne;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.EJBQLQuery;
-import org.apache.cayenne.query.SQLSelect;
-import org.apache.cayenne.query.Select;
-import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.numeric_types.BigDecimalEntity;
@@ -38,10 +39,6 @@ import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.List;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQualifiedEntityIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQualifiedEntityIT.java
index de81256c..98ed771 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQualifiedEntityIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQualifiedEntityIT.java
@@ -19,14 +19,12 @@
 
 package org.apache.cayenne.access;
 
-import static org.junit.Assert.assertEquals;
-
 import java.sql.Types;
 import java.util.List;
 
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.inheritance_people.AbstractPerson;
 import org.apache.cayenne.testdo.inheritance_people.CustomerRepresentative;
@@ -36,6 +34,8 @@ import org.apache.cayenne.unit.di.server.PeopleProjectCase;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+
 public class DataContextQualifiedEntityIT extends PeopleProjectCase {
 
     @Inject
@@ -83,20 +83,19 @@ public class DataContextQualifiedEntityIT extends PeopleProjectCase {
         // no inheritance checks in this case...
 
         // select Abstract Ppl
-        List<?> abstractPpl = context.performQuery(new SelectQuery(AbstractPerson.class));
+        List<AbstractPerson> abstractPpl = ObjectSelect.query(AbstractPerson.class).select(context);
         assertEquals(6, abstractPpl.size());
 
         // select Customer Reps
-        List<?> customerReps = context.performQuery(new SelectQuery(
-                CustomerRepresentative.class));
+        List<CustomerRepresentative> customerReps = ObjectSelect.query(CustomerRepresentative.class).select(context);
         assertEquals(1, customerReps.size());
 
         // select Employees
-        List<?> employees = context.performQuery(new SelectQuery(Employee.class));
+        List<Employee> employees = ObjectSelect.query(Employee.class).select(context);
         assertEquals(5, employees.size());
 
         // select Managers
-        List<?> managers = context.performQuery(new SelectQuery(Manager.class));
+        List<Manager> managers = ObjectSelect.query(Manager.class).select(context);
         assertEquals(2, managers.size());
     }
 
@@ -105,7 +104,7 @@ public class DataContextQualifiedEntityIT extends PeopleProjectCase {
         createPersonsDataSet();
 
         // select Managers.. make sure prefetch query works as expected
-        List<?> managers = context.performQuery(new SelectQuery(Manager.class));
+        List<Manager> managers = ObjectSelect.query(Manager.class).select(context);
         assertEquals(2, managers.size());
     }
 }
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQueryChainIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQueryChainIT.java
index 50804d2..01acd47 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQueryChainIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextQueryChainIT.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.cayenne.access;
 
+import java.util.List;
+
 import org.apache.cayenne.DataRow;
 import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.di.Inject;
@@ -29,8 +31,6 @@ import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Test;
 
-import java.util.List;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -41,6 +41,7 @@ public class DataContextQueryChainIT extends ServerCase {
     private DataContext context;
 
     @Test
+    @Deprecated
     public void testSelectQuery() {
         Artist a1 = context.newObject(Artist.class);
         a1.setArtistName("X");
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextValidationIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextValidationIT.java
index 7282e20..8a1f31d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextValidationIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextValidationIT.java
@@ -20,14 +20,13 @@
 package org.apache.cayenne.access;
 
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Painting;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.apache.cayenne.unit.util.ValidationDelegate;
-import org.apache.cayenne.validation.ValidationResult;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -71,15 +70,12 @@ public class DataContextValidationIT extends ServerCase {
     @Test
     public void testValidationModifyingContext() throws Exception {
 
-        ValidationDelegate delegate = new ValidationDelegate() {
+        ValidationDelegate delegate = (object, validationResult) -> {
 
-            public void validateForSave(Object object, ValidationResult validationResult)
{
-
-                Artist a = (Artist) object;
-                Painting p = a.getObjectContext().newObject(Painting.class);
-                p.setPaintingTitle("XXX");
-                p.setToArtist(a);
-            }
+            Artist a = (Artist) object;
+            Painting p = a.getObjectContext().newObject(Painting.class);
+            p.setPaintingTitle("XXX");
+            p.setToArtist(a);
         };
 
         context.setValidatingObjectsOnCommit(true);
@@ -94,6 +90,6 @@ public class DataContextValidationIT extends ServerCase {
         a2.setArtistName("a2");
         context.commitChanges();
 
-        assertEquals(2, context.performQuery(new SelectQuery(Painting.class)).size());
+        assertEquals(2, ObjectSelect.query(Painting.class).select(context).size());
     }
 }
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DeleteObjectIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/DeleteObjectIT.java
index 83795e8..8aa24f4 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DeleteObjectIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DeleteObjectIT.java
@@ -19,13 +19,16 @@
 
 package org.apache.cayenne.access;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.cayenne.Cayenne;
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DeleteRule;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.query.ObjectSelect;
-import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.testmap.Artist;
@@ -36,10 +39,6 @@ import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
@@ -102,7 +101,7 @@ public class DeleteObjectIT extends ServerCase {
     public void testDeleteObjects1() throws Exception {
         createObjectsDataSet();
 
-        List<Artist> artists = context.performQuery(new SelectQuery(Artist.class));
+        List<Artist> artists = ObjectSelect.query(Artist.class).select(context);
         assertEquals(2, artists.size());
 
         for (Artist object : artists) {
@@ -122,7 +121,7 @@ public class DeleteObjectIT extends ServerCase {
     public void testDeleteObjects2() throws Exception {
         createObjectsDataSet();
 
-        List<Artist> artists = context.performQuery(new SelectQuery(Artist.class));
+        List<Artist> artists = ObjectSelect.query(Artist.class).select(context);
         assertEquals(2, artists.size());
 
         for (Artist object : artists) {
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/FlattenedRelationshipInContextIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/FlattenedRelationshipInContextIT.java
index 2c47619..dfbd63c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/FlattenedRelationshipInContextIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/FlattenedRelationshipInContextIT.java
@@ -19,10 +19,12 @@
 
 package org.apache.cayenne.access;
 
+import java.util.List;
+
 import org.apache.cayenne.Fault;
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.reflect.ArcProperty;
 import org.apache.cayenne.reflect.ClassDescriptor;
 import org.apache.cayenne.test.jdbc.DBHelper;
@@ -34,8 +36,6 @@ import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.List;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -78,9 +78,9 @@ public class FlattenedRelationshipInContextIT extends ServerCase {
         createFlattenedTestDataSet();
 
         // fetch
-        List<?> ft3s = context.performQuery(new SelectQuery(FlattenedTest3.class));
+        List<FlattenedTest3> ft3s = ObjectSelect.query(FlattenedTest3.class).select(context);
         assertEquals(1, ft3s.size());
-        FlattenedTest3 ft3 = (FlattenedTest3) ft3s.get(0);
+        FlattenedTest3 ft3 = ft3s.get(0);
 
         // mark as dirty for the purpose of the test...
         ft3.setPersistenceState(PersistenceState.MODIFIED);
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/NestedDataContext_DeadlockIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/NestedDataContext_DeadlockIT.java
index 978bf9a..ce431fa 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/NestedDataContext_DeadlockIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/NestedDataContext_DeadlockIT.java
@@ -18,15 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.access;
 
-import static org.junit.Assert.assertFalse;
-
 import java.util.List;
 import java.util.Random;
 
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.test.parallel.ParallelTestContainer;
@@ -37,6 +35,8 @@ import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
+
 @UseServerRuntime(CayenneProjects.TESTMAP_PROJECT)
 public class NestedDataContext_DeadlockIT extends ServerCase {
 
@@ -109,7 +109,7 @@ public class NestedDataContext_DeadlockIT extends ServerCase {
 		@Override
 		public void run() {
 
-			List<Artist> artists = nestedContext.select(new SelectQuery<Artist>(Artist.class));
+			List<Artist> artists = nestedContext.select(ObjectSelect.query(Artist.class));
 
 			for (int i = 0; i < 100; i++) {
 
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/ObjectStoreGCIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/ObjectStoreGCIT.java
index f4be606..a43a83b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/ObjectStoreGCIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/ObjectStoreGCIT.java
@@ -20,13 +20,13 @@ package org.apache.cayenne.access;
 
 import org.apache.cayenne.Cayenne;
 import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.query.SQLTemplate;
-import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.parallel.ParallelTestContainer;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
-import org.apache.cayenne.unit.di.server.WeakReferenceStrategyServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
+import org.apache.cayenne.unit.di.server.WeakReferenceStrategyServerCase;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -44,7 +44,7 @@ public class ObjectStoreGCIT extends WeakReferenceStrategyServerCase {
                 "insert into ARTIST (ARTIST_ID, ARTIST_NAME) values (1, 'aa')"));
 
         assertEquals(0, context.getObjectStore().registeredObjectsCount());
-        context.performQuery(new SelectQuery(Artist.class));
+        ObjectSelect.query(Artist.class).select(context);
         assertEquals(1, context.getObjectStore().registeredObjectsCount());
 
         // allow for slow GC
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
index e7734a1..1b49875 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
@@ -510,9 +510,9 @@ public class VerticalInheritanceIT extends ServerCase {
 		ivRootTable.insert(4, "xROOT_SUB2", "IvSub2");
 		ivSub2Table.insert(4, "xSUB2");
 
-		SelectQuery<IvRoot> query = new SelectQuery<>(IvRoot.class);
+		ObjectSelect<IvRoot> query = ObjectSelect.query(IvRoot.class);
 
-		List<IvRoot> results = context.select(query);
+		List<IvRoot> results = query.select(context);
 
 		assertEquals(4, results.size());
 		Map<String, IvRoot> resultTypes = new HashMap<>();


Mime
View raw message