cayenne-commits mailing list archives

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

ntimofeev 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 4e40399  CAY-2378 Switch usage of SelectQuery to ObjectSelect internally
4e40399 is described below

commit 4e4039989252fb350b9bc22b50e9a3c4be8f4010
Author: Nikita Timofeev <stariy95@gmail.com>
AuthorDate: Mon Aug 12 16:30:00 2019 +0300

    CAY-2378 Switch usage of SelectQuery to ObjectSelect internally
---
 .../cayenne/lifecycle/relationship/ObjectIdBatchFault.java  | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
index 880f288..91b6076 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
@@ -33,7 +33,7 @@ import org.apache.cayenne.lifecycle.id.EntityIdCoder;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.ObjectIdQuery;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 
 /**
  * Provides lazy faulting functionality for a map of objects identified by
@@ -93,7 +93,7 @@ class ObjectIdBatchFault {
 			}
 		}
 
-		Map<String, SelectQuery<DataObject>> queriesByEntity = new HashMap<>();
+		Map<String, ObjectSelect<DataObject>> queriesByEntity = new HashMap<>();
 		Map<String, EntityIdCoder> codersByEntity = new HashMap<>();
 
 		for (ObjectIdBatchSourceItem source : sources) {
@@ -101,13 +101,13 @@ class ObjectIdBatchFault {
 			String uuid = source.getId();
 			String entityName = EntityIdCoder.getEntityName(uuid);
 			EntityIdCoder coder = codersByEntity.get(entityName);
-			SelectQuery<DataObject> query;
+			ObjectSelect<DataObject> query;
 
 			if (coder == null) {
 				coder = new EntityIdCoder(resolver.getObjEntity(entityName));
 				codersByEntity.put(entityName, coder);
 
-				query = new SelectQuery<>(entityName);
+				query = ObjectSelect.query(DataObject.class, entityName);
 				queriesByEntity.put(entityName, query);
 			} else {
 				query = queriesByEntity.get(entityName);
@@ -115,14 +115,13 @@ class ObjectIdBatchFault {
 
 			ObjectId id = coder.toObjectId(uuid);
 			Expression idExp = ExpressionFactory.matchAllDbExp(id.getIdSnapshot(), Expression.EQUAL_TO);
-			query.orQualifier(idExp);
+			query.or(idExp);
 		}
 
 		int capacity = (int) Math.ceil(sources.size() / 0.75d);
 		Map<String, Object> results = new HashMap<>(capacity);
 
-		for (SelectQuery<DataObject> query : queriesByEntity.values()) {
-
+		for (ObjectSelect<DataObject> query : queriesByEntity.values()) {
 			EntityIdCoder coder = codersByEntity.get(query.getRoot());
 			@SuppressWarnings("unchecked")
 			List<DataObject> objects = context.performQuery(query);


Mime
View raw message