openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r427191 - in /incubator/openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-kernel/src/main/resources/org/apache/openjpa/conf/ openjpa-project/src/doc/manual/
Date Mon, 31 Jul 2006 18:24:45 GMT
Author: awhite
Date: Mon Jul 31 11:24:44 2006
New Revision: 427191

URL: http://svn.apache.org/viewvc?rev=427191&view=rev
Log:
Added openjpa.MaxFetchDepth configuration property to globally control default
max fetch depth.


Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
    incubator/openjpa/trunk/openjpa-project/src/doc/manual/manual.xml

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java?rev=427191&r1=427190&r2=427191&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
Mon Jul 31 11:24:44 2006
@@ -1024,6 +1024,23 @@
     public void setFetchBatchSize(Integer size);
 
     /**
+     * The maximum relation depth to traverse when eager fetching.  Use
+     * -1 for no limit.
+     */
+    public int getMaxFetchDepth();
+
+    /**
+     * The maximum relation depth to traverse when eager fetching.  Use
+     * -1 for no limit.
+     */
+    public void setMaxFetchDepth(int depth);
+
+    /**
+     * Wrapper for JCA usage of {@link #setMaxFetchDepth(int)}.
+     */
+    public void setMaxFetchDepth(Integer size);
+
+    /**
      * Comma-separated list of fetch group names that will be pre-set for
      * all new {@link FetchConfiguration}s.
      *

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java?rev=427191&r1=427190&r2=427191&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
Mon Jul 31 11:24:44 2006
@@ -91,6 +91,7 @@
     public BooleanValue transactionMode;
     public IntValue connectionRetainMode;
     public IntValue fetchBatchSize;
+    public IntValue maxFetchDepth;
     public StringListValue fetchGroups;
     public IntValue flushBeforeQueries;
     public IntValue lockTimeout;
@@ -410,6 +411,10 @@
         fetchBatchSize.setDefault("-1");
         fetchBatchSize.set(-1);
 
+        maxFetchDepth = addInt("MaxFetchDepth");
+        maxFetchDepth.setDefault("1");
+        maxFetchDepth.set(1);
+
         fetchGroups = addStringList("FetchGroups");
         fetchGroups.setDefault("default");
         fetchGroups.set(new String[]{ "default" });
@@ -1205,6 +1210,20 @@
 
     public int getFetchBatchSize() {
         return fetchBatchSize.get();
+    }
+
+    public void setMaxFetchDepth(int maxFetchDepth) {
+        assertNotReadOnly();
+        this.maxFetchDepth.set(maxFetchDepth);
+    }
+
+    public void setMaxFetchDepth(Integer maxFetchDepth) {
+        if (maxFetchDepth != null)
+            setMaxFetchDepth(maxFetchDepth.intValue());
+    }
+
+    public int getMaxFetchDepth() {
+        return maxFetchDepth.get();
     }
 
     public void setFetchGroups(String fetchGroups) {

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java?rev=427191&r1=427190&r2=427191&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
Mon Jul 31 11:24:44 2006
@@ -113,6 +113,7 @@
         setFlushBeforeQueries(conf.getFlushBeforeQueriesConstant());
         clearFetchGroups();
         addFetchGroups(Arrays.asList(conf.getFetchGroupsList()));
+        setMaxFetchDepth(conf.getMaxFetchDepth());
     }
 
     /**
@@ -170,9 +171,14 @@
     }
 
     public FetchConfiguration setMaxFetchDepth(int depth) {
-        _state.maxFetchDepth = depth;
-        if (_parent == null)
-            _availableDepth = depth;
+        if (depth == DEFAULT && _state.ctx != null)
+            depth = _state.ctx.getConfiguration().getMaxFetchDepth();
+        if (depth != DEFAULT)
+        {
+            _state.maxFetchDepth = depth;
+            if (_parent == null)
+                _availableDepth = depth;
+        }
         return this;
     }
 

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties?rev=427191&r1=427190&r2=427191&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
Mon Jul 31 11:24:44 2006
@@ -103,6 +103,14 @@
 FetchBatchSize-displayorder: 50
 FetchBatchSize-expert: true
 
+MaxFetchDepth-name: Maximum fetch depth.
+MaxFetchDepth-desc: The maximum relation depth to traverse when eager \
+    fetching, or -1 for no limit.
+MaxFetchDepth-type: Optimization
+MaxFetchDepth-cat: Fetching
+MaxFetchDepth-displayorder: 50
+MaxFetchDepth-expert: true
+
 FetchGroups-name: Fetch groups to add to default fetch group
 FetchGroups-desc: A comma-separated list of fetch group names that wll be \
 	loaded by default when fetching data from the data store.

Modified: incubator/openjpa/trunk/openjpa-project/src/doc/manual/manual.xml
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-project/src/doc/manual/manual.xml?rev=427191&r1=427190&r2=427191&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-project/src/doc/manual/manual.xml (original)
+++ incubator/openjpa/trunk/openjpa-project/src/doc/manual/manual.xml Mon Jul 31 11:24:44
2006
@@ -17409,6 +17409,38 @@
       of the object-to-datastore mapping to use.
       </para>
         </section>
+        <section id="openjpa.MaxFetchDepth">
+          <title>openjpa.MaxFetchDepth</title>
+          <indexterm zone="openjpa.MaxFetchDepth">
+            <primary>MaxFetchDepth</primary>
+          </indexterm>
+          <indexterm zone="openjpa.MaxFetchDepth">
+            <primary>eager fetching</primary>
+            <secondary>MaxFetchDepth</secondary>
+          </indexterm>
+          <para>
+            <emphasis role="bold">Property name:</emphasis>
+            <literal>openjpa.MaxFetchDepth</literal>
+          </para>
+          <para>
+            <emphasis role="bold">Configuration API:</emphasis>
+            <ulink url="../apidocs/org/apache/openjpa/conf/OpenJPAConfiguration.html#getMaxFetchDepth">
+              <methodname>org.apache.openjpa.conf.OpenJPAConfiguration.getMaxFetchDepth</methodname>
+            </ulink>
+          </para>
+          <para>
+            <emphasis role="bold">Resource adaptor config-property:</emphasis>
+            <literal>MaxFetchDepth</literal>
+          </para>
+          <para>
+            <emphasis role="bold">Default:</emphasis>
+            <literal>1</literal>
+          </para>
+          <para><emphasis role="bold">Description:</emphasis>  The maximum
+      depth of relations to traverse when eager fetching.  Use -1 for no limit.
+      Defaults to 1.
+      </para>
+        </section>
         <section id="openjpa.MetaDataFactory">
           <title>openjpa.MetaDataFactory</title>
           <indexterm zone="openjpa.MetaDataFactory">



Mime
View raw message