OPENJPA-1097 Add some doc details on how the serialization of proxies works and new behavior of using DetachedStateField to ensure proxies are removed when it is set to transient or false.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@926160 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-03-22 16:26:51 +00:00
parent 7c613e69d1
commit 28d495e14b
2 changed files with 65 additions and 3 deletions

View File

@ -1534,6 +1534,61 @@ You can plug your custom proxy manager into the OpenJPA runtime through the
</programlisting>
</example>
</section>
<section id="ref_guide_pc_scos_proxy_serial">
<title>
Serialization
</title>
<indexterm zone="ref_guide_pc_scos_proxy_serial">
<primary>
proxies
</primary>
<secondary>
serialization
</secondary>
</indexterm>
<indexterm zone="ref_guide_pc_scos_proxy_serial">
<primary>
proxies
</primary>
<secondary>
DetachedStateField
</secondary>
</indexterm>
<para>
When objects are serialized, the <literal>DetachedStateField</literal> in
section <xref linkend="ref_guide_detach_state"/>
will be used to help determine when build time proxies will be removed.
If runtime created proxies are being used (proxies not supplied by OpenJPA)
or if an entity has already been detached, then any found proxies will be
removed during serialization.
</para>
<itemizedlist>
<listitem>
<para>
<literal>transient</literal>: Use a transient detached state field. This gives
the benefits of a detached state field to local objects that are never
serialized, but retains serialization compatibility for client tiers without
access to the enhanced versions of your classes or the OpenJPA runtime.
All proxies will be removed during serialization. This is the default.
</para>
</listitem>
<listitem>
<para>
<literal>true</literal>: Use a non-transient detached state field so that
objects crossing serialization barriers can still be attached efficiently. This
requires, however, that your client tier have the enhanced versions of your
classes and the OpenJPA runtime.
No OpenJPA provided proxies will be removed during serialization.
</para>
</listitem>
<listitem>
<para>
<literal>false</literal>: Do not use a detached state field.
All proxies will be removed during serialization.
</para>
</listitem>
</itemizedlist>
</section>
</section>
<section id="ref_guide_pc_extern">
<title>

View File

@ -290,7 +290,8 @@ to your application. Set this property to one of the following values:
<literal>transient</literal>: Use a transient detached state field. This gives
the benefits of a detached state field to local objects that are never
serialized, but retains serialization compatibility for client tiers without
access to the enhanced versions of your classes. This is the default.
access to the enhanced versions of your classes or the OpenJPA runtime.
This is the default.
</para>
</listitem>
<listitem>
@ -298,16 +299,22 @@ access to the enhanced versions of your classes. This is the default.
<literal>true</literal>: Use a non-transient detached state field so that
objects crossing serialization barriers can still be attached efficiently. This
requires, however, that your client tier have the enhanced versions of your
classes and the OpenJPA libraries.
classes and the OpenJPA runtime.
</para>
</listitem>
<listitem>
<para>
<literal>false</literal>: Do not use a detached state field.
<literal>false</literal>: Do not use a detached state field. No OpenJPA runtime
will be required for client tiers.
</para>
</listitem>
</itemizedlist>
<para>
The detached state field is also used to determine when proxies should be
removed from entities during serialization. See the
<xref linkend="ref_guide_pc_scos_proxy_serial"/> section for more details.
</para>
<para>
You can override the setting of this property or declare your own detached state
field on individual classes using OpenJPA's metadata extensions. See
<xref linkend="ref_guide_detach_field"/> below.