mirror of https://github.com/apache/openjpa.git
Added openjpa.MaxFetchDepth configuration property to globally control default
max fetch depth. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@427191 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
979d2340e9
commit
f279a6790b
|
@ -1023,6 +1023,23 @@ public interface OpenJPAConfiguration
|
||||||
*/
|
*/
|
||||||
public void setFetchBatchSize(Integer size);
|
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
|
* Comma-separated list of fetch group names that will be pre-set for
|
||||||
* all new {@link FetchConfiguration}s.
|
* all new {@link FetchConfiguration}s.
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class OpenJPAConfigurationImpl
|
||||||
public BooleanValue transactionMode;
|
public BooleanValue transactionMode;
|
||||||
public IntValue connectionRetainMode;
|
public IntValue connectionRetainMode;
|
||||||
public IntValue fetchBatchSize;
|
public IntValue fetchBatchSize;
|
||||||
|
public IntValue maxFetchDepth;
|
||||||
public StringListValue fetchGroups;
|
public StringListValue fetchGroups;
|
||||||
public IntValue flushBeforeQueries;
|
public IntValue flushBeforeQueries;
|
||||||
public IntValue lockTimeout;
|
public IntValue lockTimeout;
|
||||||
|
@ -410,6 +411,10 @@ public class OpenJPAConfigurationImpl
|
||||||
fetchBatchSize.setDefault("-1");
|
fetchBatchSize.setDefault("-1");
|
||||||
fetchBatchSize.set(-1);
|
fetchBatchSize.set(-1);
|
||||||
|
|
||||||
|
maxFetchDepth = addInt("MaxFetchDepth");
|
||||||
|
maxFetchDepth.setDefault("1");
|
||||||
|
maxFetchDepth.set(1);
|
||||||
|
|
||||||
fetchGroups = addStringList("FetchGroups");
|
fetchGroups = addStringList("FetchGroups");
|
||||||
fetchGroups.setDefault("default");
|
fetchGroups.setDefault("default");
|
||||||
fetchGroups.set(new String[]{ "default" });
|
fetchGroups.set(new String[]{ "default" });
|
||||||
|
@ -1207,6 +1212,20 @@ public class OpenJPAConfigurationImpl
|
||||||
return fetchBatchSize.get();
|
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) {
|
public void setFetchGroups(String fetchGroups) {
|
||||||
assertNotReadOnly();
|
assertNotReadOnly();
|
||||||
this.fetchGroups.setString(fetchGroups);
|
this.fetchGroups.setString(fetchGroups);
|
||||||
|
|
|
@ -113,6 +113,7 @@ public class FetchConfigurationImpl
|
||||||
setFlushBeforeQueries(conf.getFlushBeforeQueriesConstant());
|
setFlushBeforeQueries(conf.getFlushBeforeQueriesConstant());
|
||||||
clearFetchGroups();
|
clearFetchGroups();
|
||||||
addFetchGroups(Arrays.asList(conf.getFetchGroupsList()));
|
addFetchGroups(Arrays.asList(conf.getFetchGroupsList()));
|
||||||
|
setMaxFetchDepth(conf.getMaxFetchDepth());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,9 +171,14 @@ public class FetchConfigurationImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
public FetchConfiguration setMaxFetchDepth(int depth) {
|
public FetchConfiguration setMaxFetchDepth(int depth) {
|
||||||
_state.maxFetchDepth = depth;
|
if (depth == DEFAULT && _state.ctx != null)
|
||||||
if (_parent == null)
|
depth = _state.ctx.getConfiguration().getMaxFetchDepth();
|
||||||
_availableDepth = depth;
|
if (depth != DEFAULT)
|
||||||
|
{
|
||||||
|
_state.maxFetchDepth = depth;
|
||||||
|
if (_parent == null)
|
||||||
|
_availableDepth = depth;
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,14 @@ FetchBatchSize-cat: Fetching
|
||||||
FetchBatchSize-displayorder: 50
|
FetchBatchSize-displayorder: 50
|
||||||
FetchBatchSize-expert: true
|
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-name: Fetch groups to add to default fetch group
|
||||||
FetchGroups-desc: A comma-separated list of fetch group names that wll be \
|
FetchGroups-desc: A comma-separated list of fetch group names that wll be \
|
||||||
loaded by default when fetching data from the data store.
|
loaded by default when fetching data from the data store.
|
||||||
|
|
|
@ -17407,6 +17407,38 @@ true(CacheSize=1000)
|
||||||
</para>
|
</para>
|
||||||
<para><emphasis role="bold">Description:</emphasis> The symbolic name
|
<para><emphasis role="bold">Description:</emphasis> The symbolic name
|
||||||
of the object-to-datastore mapping to use.
|
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>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
<section id="openjpa.MetaDataFactory">
|
<section id="openjpa.MetaDataFactory">
|
||||||
|
|
Loading…
Reference in New Issue