openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r794774 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-persistence-jdbc/src/main/ant/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persis...
Date Thu, 16 Jul 2009 18:46:22 GMT
Author: jrbauer
Date: Thu Jul 16 18:46:22 2009
New Revision: 794774

URL: http://svn.apache.org/viewvc?rev=794774&view=rev
Log:
OPENJPA-1176 Add compatibility option to allow private persistent properties

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/AccessModsEntity.java
  (with props)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/PrivAccessModsEntity.java
  (with props)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestAccessMods.java
  (with props)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestCompatAccessMods.java
  (with props)
Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/ant/enhancer.xml
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
    openjpa/trunk/openjpa-project/src/doc/manual/migration_considerations.xml

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java?rev=794774&r1=794773&r2=794774&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
Thu Jul 16 18:46:22 2009
@@ -59,6 +59,7 @@
     private boolean _cascadeWithDetach = false;
     private boolean _useJPA2DefaultOrderColumnName = true;
     private boolean _copyOnDetach = false;
+    private boolean _privatePersistentProperties = false;
     
     /**
      * Whether to require exact identity value types when creating object
@@ -354,4 +355,34 @@
     public void setUseJPA2DefaultOrderColumnName(boolean useJPA2Name) {
         _useJPA2DefaultOrderColumnName = useJPA2Name;
     }
+    
+
+    /**
+     * Whether OpenJPA allows private, non-transient properties to be 
+     * persistent.  Prior to OpenJPA 2.0, if property access was used,
+     * private properties were considered persistent. This is contrary to the
+     * JPA specification, which states that persistent properties must be
+     * public or protected.  The default value is false.
+     * 
+     * @since 2.0.0
+     * @return true if non-transient private properties should be persistent 
+     */
+    public boolean getPrivatePersistentProperties() {
+        return _privatePersistentProperties;
+    }
+
+    /**
+     * Whether OpenJPA allows private, non-transient properties to be 
+     * persistent.  Prior to OpenJPA 2.0, if property access was used,
+     * private properties were considered persistent. This is contrary to the
+     * JPA specification, which states that persistent properties must be
+     * public or protected.
+     * 
+     * @param privateProps true if non-transient private properties 
+     *        should be persistent
+     * @since 2.0.0
+     */
+    public void setPrivatePersistentProperties(boolean privateProps) {
+        _privatePersistentProperties = privateProps;
+    }    
 }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java?rev=794774&r1=794773&r2=794774&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataDefaults.java
Thu Jul 16 18:46:22 2009
@@ -375,11 +375,13 @@
      * or<br>
      * <code> public T isXXX()</code> where T is boolean or Boolean.<br>
      */
-    public static boolean isGetter(Method method) {
+    public static boolean isGetter(Method method, boolean includePrivate) {
     	if (method == null)
     		return false;
     	int mods = method.getModifiers();
-    	if (!Modifier.isPublic(mods) 
+    	if (!(Modifier.isPublic(mods) 
+    	      || Modifier.isProtected(mods)
+    	      || (Modifier.isPrivate(mods) && includePrivate))
     	 || Modifier.isNative(mods) 
     	 || Modifier.isStatic(mods))
     		return false;

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/ant/enhancer.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/ant/enhancer.xml?rev=794774&r1=794773&r2=794774&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/ant/enhancer.xml (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/ant/enhancer.xml Thu Jul 16 18:46:22 2009
@@ -80,6 +80,7 @@
             <exclude name="**/Unenhanced*.class" />
             <exclude name="**/AbstractUnenhanced*.class" />
             <exclude name="**/unenhanced/*.class" />
+			<exclude name="**/persistence/property/PrivAccessModsEntity.class"/>
         </fileset>
         <openjpac>
             <classpath refid="cp" />
@@ -98,6 +99,14 @@
             </fileset>
             <config log="DefaultLevel=${openjpa.loglevel}" />
         </openjpac>
-
+		<!-- Enhance with private persistent properties compatibility option -->
+        <openjpac>
+            <config compatibility="PrivatePersistentProperties=true" />
+            <classpath refid="cp" />
+            <fileset dir="${project.build.testOutputDirectory}">
+				<include name="**/persistence/property/PrivAccessModsEntity.class"/>
+            </fileset>
+            <config log="DefaultLevel=${openjpa.loglevel}" />
+        </openjpac>
     </target>
 </project>
\ No newline at end of file

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/AccessModsEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/AccessModsEntity.java?rev=794774&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/AccessModsEntity.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/AccessModsEntity.java
Thu Jul 16 18:46:22 2009
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.persistence.property;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name="PUBPROT_TBL")
+public class AccessModsEntity {
+
+    private int id;
+    
+    private String pubString;
+    
+    private String protString;
+    
+    private String privString;
+    
+    
+    @Id
+    @GeneratedValue
+    public int getId() {
+        return id;
+    }
+    
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public void setPubString(String pubString) {
+        this.pubString = pubString;
+    }
+
+    @Column(name="PUB_COL")
+    public String getPubString() {
+        return pubString;
+    }
+
+    protected void setProtString(String protString) {
+        this.protString = protString;
+    }
+
+    @Column(name="PROT_COL")
+    protected String getProtString() {
+        return protString;
+    }
+
+    private void setPrivString(String privString) {
+        this.privString = privString;
+    }
+
+    @Column(name="PRIV_COL")
+    private String getPrivString() {
+        return privString;
+    }    
+
+    // Transient public wrapper around private property
+    public void setPubPrivString(String privString) {
+        setPrivString(privString);
+    }
+
+    // Transient public wrapper around private property
+    @Transient
+    public String getPubPrivString() {
+        return getPrivString();
+    }    
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/AccessModsEntity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/PrivAccessModsEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/PrivAccessModsEntity.java?rev=794774&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/PrivAccessModsEntity.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/PrivAccessModsEntity.java
Thu Jul 16 18:46:22 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.persistence.property;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name="PRIV_TBL")
+public class PrivAccessModsEntity {
+
+    private int id;
+    
+    private String pubString;
+    
+    private String protString;
+    
+    private String privString;
+        
+    @Id
+    @GeneratedValue
+    public int getId() {
+        return id;
+    }
+    
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public void setPubString(String pubString) {
+        this.pubString = pubString;
+    }
+
+    @Column(name="PUB_COL")
+    public String getPubString() {
+        return pubString;
+    }
+
+    protected void setProtString(String protString) {
+        this.protString = protString;
+    }
+
+    @Column(name="PROT_COL")
+    protected String getProtString() {
+        return protString;
+    }
+
+    private void setPrivString(String privString) {
+        this.privString = privString;
+    }
+
+    @Column(name="PRIV_COL")
+    private String getPrivString() {
+        return privString;
+    }    
+
+    // Transient public wrapper around private property
+    public void setPubPrivString(String privString) {
+        setPrivString(privString);
+    }
+
+    // Transient public wrapper around private property
+    @Transient
+    public String getPubPrivString() {
+        return getPrivString();
+    }    
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/PrivAccessModsEntity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestAccessMods.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestAccessMods.java?rev=794774&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestAccessMods.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestAccessMods.java
Thu Jul 16 18:46:22 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.persistence.property;
+
+import javax.persistence.EntityManager;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+public class TestAccessMods 
+    extends SingleEMFTestCase {
+
+        public void setUp() {
+            setUp(DROP_TABLES, AccessModsEntity.class);
+        }
+        
+        /**
+         * Verifies that by default, per JPA spec, non-transient public and 
+         * protected properties should be persistent.  Private should not be
+         * persistent.
+         */
+        public void testAccessMods() {
+            EntityManager em = emf.createEntityManager();            
+            
+            AccessModsEntity ame = new AccessModsEntity();
+            
+            // Set all properties
+            ame.setPubString("Public");
+            ame.setProtString("Protected");
+            ame.setPubPrivString("Private"); 
+            // Persist the entity.  Public and protected properties should
+            // get persisted.  Private should not.
+            em.getTransaction().begin();
+            em.persist(ame);
+            em.getTransaction().commit();
+            em.clear();
+            
+            ame = em.find(AccessModsEntity.class, ame.getId());
+            assertNotNull(ame);
+            assertEquals("Public", ame.getPubString());
+            assertEquals("Protected", ame.getProtString());
+            assertNull(ame.getPubPrivString());
+            em.close();
+        }
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestAccessMods.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestCompatAccessMods.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestCompatAccessMods.java?rev=794774&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestCompatAccessMods.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestCompatAccessMods.java
Thu Jul 16 18:46:22 2009
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.persistence.property;
+
+import javax.persistence.EntityManager;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+public class TestCompatAccessMods extends SingleEMFTestCase {
+
+    @Override
+    public void setUp() {
+        setUp("openjpa.Compatibility", "PrivatePersistentProperties=true", 
+            DROP_TABLES, PrivAccessModsEntity.class);
+    }
+
+    /**
+     * Verifies that with the PrivatePersistentProperties compatibility option
+     * enabled, non-transient private properties are persistent.
+     * 
+     * Note: PrivAccessModsEntity must also be enhanced with the compatibility
+     * option set to true.  This is currently handled in the test suite by
+     * a separate enhancement task for PrivAccessModsEntity.
+     */
+    public void testAccessMods() {
+        EntityManager em = emf.createEntityManager();            
+        
+        PrivAccessModsEntity pame = new PrivAccessModsEntity();
+        
+        // Set all properties
+        pame.setPubString("Public");
+        pame.setProtString("Protected");
+        pame.setPubPrivString("Private"); 
+        // Persist the entity.  All properties should be persisted.
+        em.getTransaction().begin();
+        em.persist(pame);
+        em.getTransaction().commit();
+        em.clear();
+        
+        pame = em.find(PrivAccessModsEntity.class, pame.getId());
+        assertNotNull(pame);
+        assertEquals("Public", pame.getPubString());
+        assertEquals("Protected", pame.getProtString());
+        assertEquals("Private", pame.getPubPrivString());
+        em.close();
+    }
+
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/property/TestCompatAccessMods.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java?rev=794774&r1=794773&r2=794774&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
Thu Jul 16 18:46:22 2009
@@ -305,7 +305,8 @@
     	int access = determineExplicitAccessType(meta.getDescribedType());
     	if (!AccessCode.isUnknown(access))
     		return access;
-    	access = determineImplicitAccessType(meta.getDescribedType());
+    	access = determineImplicitAccessType(meta.getDescribedType(),
+    	            meta.getRepository().getConfiguration());
     	if (!AccessCode.isUnknown(access))
     		return access;
     	
@@ -331,7 +332,8 @@
      * Annotation can be placed on either fields or getters but not on both.
      * If no field or getter is annotated then UNKNOWN access code is returned.
      */
-    private int determineImplicitAccessType(Class<?> cls) {
+    private int determineImplicitAccessType(Class<?> cls, OpenJPAConfiguration
+        conf) {
     	if (cls.isInterface()) // Managed interfaces
     		return AccessCode.PROPERTY;
         Field[] allFields = AccessController.doPrivileged(J2DoPrivHelper.
@@ -339,6 +341,15 @@
 		Method[] methods = AccessController.doPrivileged(
 				J2DoPrivHelper.getDeclaredMethodsAction(cls));
         List<Field> fields = filter(allFields, nonTransientFilter);
+        /*
+         * OpenJPA 1.x permitted private properties to be persistent.  This is
+         * contrary to the JPA 1.0 specification, which states that persistent
+         * properties must be private or protected. OpenJPA 2.0+ will adhere
+         * to the specification by default, but provides a compatibility
+         * option to provide pre-2.0 behavior.
+         */
+        getterFilter.setIncludePrivate(
+            conf.getCompatibilityInstance().getPrivatePersistentProperties());
         List<Method> getters = filter(methods, getterFilter, 
         		nonTransientFilter);
         if (fields.isEmpty() && getters.isEmpty())
@@ -550,9 +561,11 @@
             }            
             try {
                 // check for setters for methods
-                Method setter = meta.getDescribedType().getMethod(
-                		"set" + StringUtils.capitalize(name), 
-                        new Class[] {((Method) member).getReturnType()});
+                Method setter = (Method) AccessController.doPrivileged(
+                    J2DoPrivHelper.getDeclaredMethodAction(
+                        meta.getDescribedType(), "set" +
+                        StringUtils.capitalize(name), new Class[] { 
+                            ((Method) member).getReturnType() }));
                 if (setter == null && !isAnnotatedTransient(member)) {
                     logNoSetter(meta, name, null);
                     return false;
@@ -716,8 +729,19 @@
      * 
      */
     static class GetterFilter implements InclusiveFilter<Method> {
+        
+        private boolean includePrivate;        
+                       
         public boolean includes(Method method) {
-            return isGetter(method);
+            return isGetter(method, isIncludePrivate());
+        }
+
+        public void setIncludePrivate(boolean includePrivate) {
+            this.includePrivate = includePrivate;
+        }
+
+        public boolean isIncludePrivate() {
+            return includePrivate;
         }
     }
 

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java?rev=794774&r1=794773&r2=794774&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
Thu Jul 16 18:46:22 2009
@@ -180,6 +180,7 @@
             Compatibility compatibility = conf.getCompatibilityInstance();
             compatibility.setFlushBeforeDetach(true);
             compatibility.setCopyOnDetach(true);
+            compatibility.setPrivatePersistentProperties(true);
         } 
         return true;
     }

Modified: openjpa/trunk/openjpa-project/src/doc/manual/migration_considerations.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/migration_considerations.xml?rev=794774&r1=794773&r2=794774&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/migration_considerations.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/migration_considerations.xml Thu Jul 16 18:46:22
2009
@@ -107,6 +107,28 @@
 					</programlisting>
 				</para>
     		</section>
+            <section id="private_persistent_properties">
+                <title>
+                    Use of private persistent properties
+                </title>
+                <para>
+                    In 1.x.x releases of OpenJPA, if property access was used,
+                    private properties were considered persistent. This is 
+                    contrary to the JPA specification, which states that 
+                    persistent properties must be public or protected.  In
+                    OpenJPA 2.0 and later, private properties will not be 
+                    persistent by default.
+                </para>
+                <para>
+                    It is possible to revert back to the 1.x.x behavior which
+                    allowed private properties to be persistent by setting the 
+                    value of the <literal>openjpa.Compatibility</literal> 
+                    property <literal>PrivatePersistentProperties</literal> to

+                    <literal>true</literal>.  If compile time enhancement is

+                    used, this property must be specified at the time of 
+                    enhancement and at runtime.
+                </para>
+            </section>
     	</section>
     </section>
 </appendix>



Mime
View raw message