cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1334372 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access: DataContext.java DataContextQueryAction.java DataDomain.java HierarchicalObjectResolver.java IncrementalFaultList.java
Date Sat, 05 May 2012 10:01:38 GMT
Author: aadamchik
Date: Sat May  5 10:01:37 2012
New Revision: 1334372

URL: http://svn.apache.org/viewvc?rev=1334372&view=rev
Log:
CAY-1700 Split long DISJOINT_BY_ID prefetch query on several smaller queries

cleanup

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContextQueryAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/HierarchicalObjectResolver.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java?rev=1334372&r1=1334371&r2=1334372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
Sat May  5 10:01:37 2012
@@ -203,15 +203,6 @@ public class DataContext extends BaseCon
     }
 
     /**
-     * Returns runtime properties fetched from parent data domain.
-     *
-     * @since 3.1
-     */
-    public RuntimeProperties getRuntimeProperties() {
-        return getParentDataDomain().getRuntimeProperties();
-    }
-
-    /**
      * Sets a DataContextDelegate for this context. Delegate is notified of certain events
      * in the DataContext lifecycle and can customize DataContext behavior.
      * 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContextQueryAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContextQueryAction.java?rev=1334372&r1=1334371&r2=1334372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContextQueryAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContextQueryAction.java
Sat May  5 10:01:37 2012
@@ -86,8 +86,7 @@ class DataContextQueryAction extends Obj
                     // would be nice to implement an alternative algorithm that wouldn't
                     // require this hack.
                     if (oidQuery.isFetchingDataRows()) {
-                        object = ((DataContext) actingContext)
-                                .currentSnapshot((Persistent) object);
+                        object = actingDataContext.currentSnapshot((Persistent) object);
                     }
                     // do not return hollow objects
                     else if (((Persistent) object).getPersistenceState() == PersistenceState.HOLLOW)
{
@@ -109,15 +108,21 @@ class DataContextQueryAction extends Obj
 
             DbEntity dbEntity = metadata.getDbEntity();
             Integer maxIdQualifierSize = actingDataContext
-                    .getRuntimeProperties().getInt(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY,
-1);
+                    .getParentDataDomain()
+                    .getRuntimeProperties()
+                    .getInt(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, -1);
             List<?> paginatedList;
             if (dbEntity != null && dbEntity.getPrimaryKeys().size() == 1) {
                 paginatedList = new SimpleIdIncrementalFaultList<Object>(
-                        (DataContext) actingContext, query, maxIdQualifierSize);
+                        actingDataContext,
+                        query,
+                        maxIdQualifierSize);
             }
             else {
                 paginatedList = new IncrementalFaultList<Object>(
-                        (DataContext) actingContext, query, maxIdQualifierSize);
+                        actingDataContext,
+                        query,
+                        maxIdQualifierSize);
             }
 
             response = new ListResponse(paginatedList);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java?rev=1334372&r1=1334371&r2=1334372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java
Sat May  5 10:01:37 2012
@@ -38,7 +38,6 @@ import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.access.jdbc.BatchQueryBuilderFactory;
 import org.apache.cayenne.cache.NestedQueryCache;
 import org.apache.cayenne.cache.QueryCache;
-import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.ObjectContextFactory;
 import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.di.BeforeScopeEnd;
@@ -78,6 +77,9 @@ public class DataDomain implements Query
     @Inject
     protected JdbcEventLogger jdbcEventLogger;
 
+    /**
+     * @since 3.1
+     */
     @Inject
     protected RuntimeProperties runtimeProperties;
 
@@ -602,7 +604,7 @@ public class DataDomain implements Query
     public DataNode getNode(String nodeName) {
         return getDataNode(nodeName);
     }
-    
+
     /**
      * Returns registered DataNode whose name matches <code>name</code> parameter.
      * 
@@ -944,10 +946,10 @@ public class DataDomain implements Query
 
     /**
      * Returns global runtime properties for this data domain.
-     *
+     * 
      * @since 3.1
      */
-    public RuntimeProperties getRuntimeProperties() {
+    RuntimeProperties getRuntimeProperties() {
         return runtimeProperties;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/HierarchicalObjectResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/HierarchicalObjectResolver.java?rev=1334372&r1=1334371&r2=1334372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/HierarchicalObjectResolver.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/HierarchicalObjectResolver.java
Sat May  5 10:01:37 2012
@@ -162,13 +162,16 @@ class HierarchicalObjectResolver {
 
             List<?> parentDataRows;
             if (parentProcessorNode instanceof PrefetchProcessorJointNode) {
-                parentDataRows = ((PrefetchProcessorJointNode) parentProcessorNode).getResolvedRows();
+                parentDataRows = ((PrefetchProcessorJointNode) parentProcessorNode)
+                        .getResolvedRows();
             }
             else {
                 parentDataRows = parentProcessorNode.getDataRows();
             }
 
-            int maxIdQualifierSize = context.getRuntimeProperties()
+            int maxIdQualifierSize = context
+                    .getParentDataDomain()
+                    .getRuntimeProperties()
                     .getInt(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, -1);
 
             List<PrefetchSelectQuery> queries = new ArrayList<PrefetchSelectQuery>();
@@ -217,7 +220,8 @@ class HierarchicalObjectResolver {
                 if (relationship.isSourceIndependentFromTargetChange()) {
                     // setup extra result columns to be able to relate result rows to the
                     // parent result objects.
-                    query.addResultPath("db:" + relationship.getReverseDbRelationshipPath());
+                    query.addResultPath("db:"
+                            + relationship.getReverseDbRelationshipPath());
                 }
                 dataRows.addAll(context.performQuery(query));
             }
@@ -288,7 +292,8 @@ class HierarchicalObjectResolver {
 
             // TODO: see TODO in ObjectResolver.relatedObjectsFromDataRows
 
-            if ((node.isDisjointPrefetch() || node.isDisjointByIdPrefetch()) && !needToSaveDuplicates)
{
+            if ((node.isDisjointPrefetch() || node.isDisjointByIdPrefetch())
+                    && !needToSaveDuplicates) {
                 PrefetchProcessorNode processorNode = (PrefetchProcessorNode) node;
                 if (processorNode.isJointChildren()) {
                     List<Persistent> objects = processorNode.getObjects();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java?rev=1334372&r1=1334371&r2=1334372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
Sat May  5 10:01:37 2012
@@ -84,6 +84,14 @@ public class IncrementalFaultList<E> imp
     // or complexity of the where clause - e.g., PostgreSQL having a default limit of
     // 10,000 nested expressions.
 
+    
+    /**
+     * @deprecated since 3.1 use {@link #IncrementalFaultList(DataContext, Query, int)}.
+     */
+    public IncrementalFaultList(DataContext dataContext, Query query) {
+        this(dataContext, query, 10000);
+    }
+    
     /**
      * Creates a new IncrementalFaultList using a given DataContext and query.
      * 



Mime
View raw message