db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r562135 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
Date Thu, 02 Aug 2007 15:29:32 GMT
Author: arminw
Date: Thu Aug  2 08:29:31 2007
New Revision: 562135

URL: http://svn.apache.org/viewvc?view=rev&rev=562135
Log:
workaround, by default disable manual prefetching because OJB will always use prefetching
if possible

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java?view=diff&rev=562135&r1=562134&r2=562135
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
Thu Aug  2 08:29:31 2007
@@ -186,11 +186,8 @@
         try
         {
             setRsAndStmt(queryObject.performQuery(broker.serviceJdbcAccess()));
-            /*
-             * TODO: how does prefetchRelationships handle QueryBySQL instances? Is
-             * it ok to pass query object?
-             */
-            prefetchRelationships(queryObject.getQuery());
+            // first check if manual prefetching (by using Query settings) is allowed
+            if(allowManualPrefetching(broker, queryObject.getQuery())) prefetchRelationships(queryObject.getQuery());
             if (logger.isDebugEnabled())
             {
                 logger.debug("RsIterator[" + queryObject + "] initialized");
@@ -329,6 +326,13 @@
         return owners;
     }
 
+    protected boolean allowManualPrefetching(PersistenceBrokerInternal broker, Query query)
+    {
+        // TODO: Is it correct to disable the manual prefetching when automatic prefetching
is enabled?
+        // Fix: Without this check, prefetching is done twice
+        return !(query == null) && query.hasPrefetchedRelationships() &&
!broker.getReferenceBroker().isAutoPrefetch();
+    }
+
     /**
      * prefetch defined relationships requires JDBC level 2.0, does not work
      * with Arrays
@@ -339,11 +343,6 @@
         Collection owners;
         String relName;
         RelationshipPrefetcher[] prefetchers;
-
-        if (query == null || !query.hasPrefetchedRelationships())
-        {
-            return;
-        }
 
         if (!supportsAdvancedJDBCCursorControl())
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message