mirror of https://github.com/apache/openjpa.git
OPENJPA-226
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@533218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a99763cf63
commit
43c931014a
|
@ -360,10 +360,12 @@ public class OpenJPAConfigurationImpl
|
|||
addValue(autoDetach);
|
||||
|
||||
detachStatePlugin = addPlugin("DetachState", true);
|
||||
aliases =
|
||||
new String[] { "loaded", DetachOptions.Loaded.class.getName(),
|
||||
"fgs", DetachOptions.FetchGroups.class.getName(), "all",
|
||||
DetachOptions.All.class.getName(), };
|
||||
aliases = new String[] {
|
||||
"loaded", DetachOptions.Loaded.class.getName(),
|
||||
"fgs", DetachOptions.FetchGroups.class.getName(),
|
||||
"fetch-groups", DetachOptions.FetchGroups.class.getName(),
|
||||
"all", DetachOptions.All.class.getName(),
|
||||
};
|
||||
detachStatePlugin.setAliases(aliases);
|
||||
detachStatePlugin.setDefault(aliases[0]);
|
||||
detachStatePlugin.setString(aliases[0]);
|
||||
|
|
|
@ -162,7 +162,7 @@ public class DetachManager
|
|||
// create bitset of fields to detach; if mode is all we can use
|
||||
// currently loaded bitset clone, since we know all fields are loaded
|
||||
if (idxs != null) {
|
||||
if (detachMode == DETACH_FGS)
|
||||
if (detachMode == DETACH_FETCH_GROUPS)
|
||||
setFetchGroupFields(broker, sm, idxs);
|
||||
else
|
||||
idxs.or(sm.getLoaded());
|
||||
|
|
|
@ -28,6 +28,13 @@ public interface DetachState {
|
|||
|
||||
/**
|
||||
* Mode to detach all fields in the current fetch groups.
|
||||
*
|
||||
* @since 0.9.8
|
||||
*/
|
||||
public static final int DETACH_FETCH_GROUPS = 0;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static final int DETACH_FGS = 0;
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class VersionAttachStrategy
|
|||
case DETACH_ALL:
|
||||
attachField(manager, toAttach, sm, fmds[i], true);
|
||||
break;
|
||||
case DETACH_FGS:
|
||||
case DETACH_FETCH_GROUPS:
|
||||
if (fetch.requiresFetch(fmds[i])
|
||||
!= FetchConfiguration.FETCH_NONE)
|
||||
attachField(manager, toAttach, sm, fmds[i], true);
|
||||
|
|
|
@ -353,7 +353,7 @@ AutoDetach-expert: true
|
|||
DetachState-name: Detach states
|
||||
DetachState-desc: Plugin describing the set of field values which will be \
|
||||
included in the default detach and related options. These states are \
|
||||
"loaded", "all", and "fgs".
|
||||
"loaded", "all", and "fetch-groups".
|
||||
DetachState-type: General
|
||||
DetachState-cat: Optimization
|
||||
DetachState-displayorder: 50
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TestGetReferenceAndImplicitDetachment
|
|||
extends SingleEMFTestCase {
|
||||
|
||||
public void setUp() {
|
||||
setUp("openjpa.DetachState", "fgs",
|
||||
setUp("openjpa.DetachState", "fetch-groups",
|
||||
DetachmentOneManyParent.class, DetachmentOneManyChild.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -1583,7 +1583,7 @@ DetachState</literal>
|
|||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">Possible values: </emphasis><literal>loaded</literal>,
|
||||
<literal>fgs</literal>, <literal>all</literal>
|
||||
<literal>fetch-groups</literal>, <literal>all</literal>
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">Description:</emphasis> Determines which fields are part
|
||||
|
|
|
@ -239,7 +239,7 @@ default.
|
|||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>fgs</literal>: Detach all fields and relations in the current
|
||||
<literal>fetch-groups</literal>: Detach all fields and relations in the current
|
||||
<link linkend="ref_guide_runtime">fetch configuration</link>. For more
|
||||
information on custom fetch groups, see <xref linkend="ref_guide_fetch"/>.
|
||||
</para>
|
||||
|
@ -333,7 +333,7 @@ use detached state managers, as determined by the settings above.
|
|||
Configuring Detached State
|
||||
</title>
|
||||
<programlisting>
|
||||
<property name="openjpa.DetachState" value="fgs(DetachedStateField=true)"/>
|
||||
<property name="openjpa.DetachState" value="fetch-groups(DetachedStateField=true)"/>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
|
@ -345,7 +345,7 @@ for controlling detached state:
|
|||
</para>
|
||||
<programlisting>
|
||||
public static final int DETACH_LOADED;
|
||||
public static final int DETACH_FGS;
|
||||
public static final int DETACH_FETCH_GROUPS;
|
||||
public static final int DETACH_ALL;
|
||||
public int getDetachState();
|
||||
public void setDetachState(int mode);
|
||||
|
|
Loading…
Reference in New Issue