You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/01/08 22:52:29 UTC
svn commit: r367103 - in /db/ojb/branches/OJB_1_0_RELEASE/src:
doc/forrest/src/documentation/content/xdocs/docu/guides/advanced-technique.xml
test/org/apache/ojb/OJB.properties
Author: arminw
Date: Sun Jan 8 13:52:21 2006
New Revision: 367103
URL: http://svn.apache.org/viewcvs?rev=367103&view=rev
Log:
add section about new PersistentFieldImplementation, update doc
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/advanced-technique.xml
db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/OJB.properties
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/advanced-technique.xml
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/advanced-technique.xml?rev=367103&r1=367102&r2=367103&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/advanced-technique.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/advanced-technique.xml Sun Jan 8 13:52:21 2006
@@ -1009,16 +1009,15 @@
method) declared in the interface.</li>
<li>Since we're using bean properties, the appropriate
<code>org.apache.ojb.broker.metadata.fieldaccess.PersistentField</code>
- implementation must be used (see <a href="#persistent-field">below</a>).
- This class is used by OJB to access the fields when storing/loading objects. Per default,
- OJB uses a direct access implementation
- (<code>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl</code>) which
- requires actual fields to be present.<br/>
+ implementation must be used. This class is used by OJB to access the
+ fields when storing/loading objects. A detailed description can be
+ found in the <a href="#persistent-field"><em>PersistentField</em> section</a>.
+ <br/>
In our case, we need an implementation that rather uses the accessor methods. Since the
- <code>PersistentField</code> setting is (currently) global, you have to check whether
- there are accessors defined for every field in the metadata. If yes, then you can use the
- <code>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl</code>,
- otherwise you'll have to resort to the
+ <code>PersistentField</code> setting is (currently OJB 1.0.x versions) global, you have
+ to check whether there are accessors defined for every field in the metadata.
+ If yes, then you can use a
+ <em>JavaBean</em> based <code>FieldDescriptor</code>, otherwise you'll have to resort to the
<code>org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldAutoProxyImpl</code>, which
determines for every field what type of field it is and then uses the appropriate
strategy.</li>
@@ -1215,12 +1214,16 @@
# By default the best performing attribute/refection based implementation
# is selected (PersistentFieldDirectAccessImpl).
#
-# - PersistentFieldDirectAccessImpl
+# - PersistentFieldDirectImpl
# is a high-speed version of the access strategies.
# It does not cooperate with an AccessController,
# but accesses the fields directly. Persistent
# attributes don't need getters and setters
# and don't have to be declared public or protected
+# - PersistentFieldCGLibImpl
+# A very fast beans compliant (getter/setter access based) PersistentField
+# implementation (it's three times faster than the direct field access via reflection).
+# Needs public getter/setter for all declared fields.
# - PersistentFieldPrivilegedImpl
# Same as above, but does cooperate with AccessController and do not
# suppress the java language access check (but is slow compared with direct access).
@@ -1233,9 +1236,12 @@
# org.apache.commons.beanutils.DynaBean.
# - PersistentFieldAutoProxyImpl
# for each field determines upon first access how to access this particular field
-# (directly, as a bean, as a dyna bean) and then uses that strategy
+# (cglib based, directly, as a bean, as a dyna bean) and then uses that strategy.
+# The order of field access testing goes from the fastest to slowest, so you will always
+# get the best performance.
#
-#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl
+PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl
+#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldCGLibImpl
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImpl
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDynaBeanImpl
@@ -1243,11 +1249,24 @@
#(DynaBean implementation does not support nested fields)
#]]></source>
<p>
- E.g. if the PersistentFieldDirectImpl is used there must be an attribute in the
- persistent class with this name, if the PersistentFieldIntrospectorImpl is used there must
- be a JavaBeans compliant property of this name.
+ E.g. if the <code>PersistentFieldDirectImpl</code> is used there must be an attribute in the
+ persistent class with this name, if the <code>PersistentFieldCGLibImpl</code> is used there must
+ be a <em>JavaBeans</em> compliant property of this name.
+ <br/>
More info about the individual implementation can be found in <a href="ext:javadoc">javadoc</a>.
</p>
+ <p>
+ Per default, OJB uses a direct access implementation (<code>PersistentFieldDirectImpl</code>)
+ which requires actual fields to be present.
+ </p>
+ <p>
+ If you have bean compliant and non-compilant persistence capable classes the
+ <code>PersistentFieldAutoProxyImpl</code> will be a good choice. In this case OJB
+ will always use the best performing strategy.
+ </p>
+ <p>
+ For best performance <code>PersistentFieldCGLibImpl</code> is recommended.
+ </p>
</section>
@@ -1264,9 +1283,9 @@
<br/>
Main class used for provide anonymous keys is
<code>org.apache.ojb.broker.metadata.fieldaccess.AnonymousPersistentField</code>. Current implementation
- use an object identity based weak HashMap. The persistent object identity is used as key for the
- anonymous key value. The (Anonymous)PersistentField instance is associated with the <em>FieldDescriptor</em>
- declared in the repository.
+ use an object identity based weak <code>HashMap</code>. The persistent object identity is used as
+ key for the anonymous key value. The (Anonymous)PersistentField instance is associated with the
+ <a href="site:repository/field-descriptor"><code>FieldDescriptor</code></a> declared in the repository.
</p>
<p>
This means that all anonymous key information will be lost when the object identity change, e.g. the
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/OJB.properties
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/OJB.properties?rev=367103&r1=367102&r2=367103&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/OJB.properties (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/OJB.properties Sun Jan 8 13:52:21 2006
@@ -411,12 +411,16 @@
# By default the best performing attribute/refection based implementation
# is selected (PersistentFieldDirectAccessImpl).
#
-# - PersistentFieldDirectAccessImpl
+# - PersistentFieldDirectImpl
# is a high-speed version of the access strategies.
# It does not cooperate with an AccessController,
# but accesses the fields directly. Persistent
# attributes don't need getters and setters
# and don't have to be declared public or protected
+# - PersistentFieldCGLibImpl
+# A very fast beans compliant (getter/setter access based) PersistentField
+# implementation (it's three times faster than the direct field access via reflection).
+# Needs public getter/setter for all declared fields.
# - PersistentFieldPrivilegedImpl
# Same as above, but does cooperate with AccessController and do not
# suppress the java language access check (but is slow compared with direct access).
@@ -429,9 +433,12 @@
# org.apache.commons.beanutils.DynaBean.
# - PersistentFieldAutoProxyImpl
# for each field determines upon first access how to access this particular field
-# (directly, as a bean, as a dyna bean) and then uses that strategy
+# (cglib based, directly, as a bean, as a dyna bean) and then uses that strategy.
+# The order of field access testing goes from the fastest to slowest, so you will always
+# get the best performance.
#
PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl
+#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldCGLibImpl
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImpl
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDynaBeanImpl
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org