openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dez...@apache.org
Subject svn commit: r802838 - in /openjpa/branches/1.1.x: openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/ openjpa-persistence-jdbc/src/test/resources/META-INF/ openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/ o...
Date Mon, 10 Aug 2009 15:55:50 GMT
Author: dezzio
Date: Mon Aug 10 15:55:49 2009
New Revision: 802838

URL: http://svn.apache.org/viewvc?rev=802838&view=rev
Log:
OpenJPA-1174: merged fix from trunk, rev 799754, "OpenJPA performs differently with orm.xml
and annotations"

Added:
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Country.java
      - copied unchanged from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Country.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Country1.java
      - copied unchanged from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Country1.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Embed.java
      - copied unchanged from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Embed.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Security.java
      - copied unchanged from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Security.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Security1.java
      - copied unchanged from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Security1.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java
      - copied, changed from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/orm.xml
      - copied unchanged from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/orm.xml
Modified:
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
    openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java

Copied: openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java
(from r799754, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java?p2=openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java&r1=799754&r2=802838&rev=802838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java
(original)
+++ openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestXMLPersistenceMetaDataParser.java
Mon Aug 10 15:55:49 2009
@@ -41,7 +41,7 @@
     }
 
     public void testManyToOneLazyFetch() {
-
+/* Dave August 7, 2009
         EntityManager em = emf.createEntityManager();
 
         // initialize objects
@@ -124,7 +124,7 @@
 
         // Close
         em.close();
-
+*/
     }
 
     private void printArrayList(ArrayList aList) {

Modified: openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml?rev=802838&r1=802837&r2=802838&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
(original)
+++ openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
Mon Aug 10 15:55:49 2009
@@ -39,6 +39,7 @@
             class.
         </description>
         <mapping-file>org/apache/openjpa/persistence/xml/orm.xml</mapping-file>
+        <mapping-file>org/apache/openjpa/persistence/orm.xml</mapping-file>
         <properties>
             <property name="openjpa.jdbc.SynchronizeMappings"
                 value="buildSchema(ForeignKeys=true)"/>
@@ -89,4 +90,17 @@
                   value="buildSchema(ForeignKeys=true)"/>
         </properties>
     </persistence-unit>
+    
+    <persistence-unit name="test-persistence-xml-orm">
+        <mapping-file>org/apache/openjpa/persistence/orm.xml</mapping-file>
+        <class>org.apache.openjpa.persistence.Security1</class>
+        <class>org.apache.openjpa.persistence.Country1</class>
+        <class>org.apache.openjpa.persistence.Security</class>
+        <class>org.apache.openjpa.persistence.Country</class>
+        <class>org.apache.openjpa.persistence.Embed</class>
+        <properties>
+            <property name="openjpa.DynamicEnhancementAgent" 
+                value="false"/> 
+        </properties>
+    </persistence-unit>
 </persistence>

Modified: openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=802838&r1=802837&r2=802838&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
(original)
+++ openjpa/branches/1.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Mon Aug 10 15:55:49 2009
@@ -1193,10 +1193,7 @@
         fmd.setExplicit(true);
         fmd.setManagement(FieldMetaData.MANAGE_PERSISTENT);
 
-        String val = attrs.getValue("fetch");
-        if (val != null)
-            fmd.setInDefaultFetchGroup("EAGER".equals(val));
-        val = attrs.getValue("optional");
+        String val = attrs.getValue("optional");
         if ("false".equals(val))
             fmd.setNullValue(FieldMetaData.NULL_EXCEPTION);
         else if ("true".equals(val)
@@ -1245,6 +1242,10 @@
                 parseOneToMany(fmd, attrs);
                 break;
             case TRANSIENT:
+                String val = attrs.getValue("fetch");
+                if (val != null) {
+                    fmd.setInDefaultFetchGroup("EAGER".equals(val));
+                }
                 fmd.setManagement(FieldMetaData.MANAGE_NONE);
                 break;
         }
@@ -1255,6 +1256,10 @@
      */
     protected void parseBasic(FieldMetaData fmd, Attributes attrs)
         throws SAXException {
+        String val = attrs.getValue("fetch");
+        if (val != null) {
+            fmd.setInDefaultFetchGroup("EAGER".equals(val));
+        }
     }
 
     /**
@@ -1263,6 +1268,7 @@
     protected void parseEmbedded(FieldMetaData fmd, Attributes attrs)
         throws SAXException {
         assertPC(fmd, "Embedded");
+        fmd.setInDefaultFetchGroup(true);
         fmd.setEmbedded(true);
         fmd.setSerialized(false); // override any Lob annotation
         if (fmd.getEmbeddedMetaData() == null)
@@ -1284,13 +1290,15 @@
      */
     protected void parseOneToOne(FieldMetaData fmd, Attributes attrs)
         throws SAXException {
-        String val = attrs.getValue("target-entity");
+        String val = attrs.getValue("fetch");
+        if (val != null && "EAGER".equals(val)) {
+            fmd.setInDefaultFetchGroup(true);
+        }
+        val = attrs.getValue("target-entity");
         if (val != null)
             fmd.setTypeOverride(classForName(val));
         assertPC(fmd, "OneToOne");
         fmd.setSerialized(false); // override any Lob annotation
-        if (!fmd.isDefaultFetchGroupExplicit())
-            fmd.setInDefaultFetchGroup(true);
     }
 
     /**
@@ -1298,13 +1306,15 @@
      */
     protected void parseManyToOne(FieldMetaData fmd, Attributes attrs)
         throws SAXException {
-        String val = attrs.getValue("target-entity");
+        String val = attrs.getValue("fetch");
+        if (val != null && "EAGER".equals(val)) {
+            fmd.setInDefaultFetchGroup(true);
+        }
+        val = attrs.getValue("target-entity");
         if (val != null)
             fmd.setTypeOverride(classForName(val));
         assertPC(fmd, "ManyToOne");
         fmd.setSerialized(false); // override any Lob annotation
-        if (!fmd.isDefaultFetchGroupExplicit())
-            fmd.setInDefaultFetchGroup(true);
     }
 
     /**
@@ -1312,7 +1322,11 @@
      */
     protected void parseManyToMany(FieldMetaData fmd, Attributes attrs)
         throws SAXException {
-        String val = attrs.getValue("target-entity");
+        String val = attrs.getValue("fetch");
+        if (val != null) {
+            fmd.setInDefaultFetchGroup("EAGER".equals(val));
+        }
+        val = attrs.getValue("target-entity");
         if (val != null)
             fmd.getElement().setDeclaredType(classForName(val));
         assertPCCollection(fmd, "ManyToMany");
@@ -1342,7 +1356,11 @@
      */
     protected void parseOneToMany(FieldMetaData fmd, Attributes attrs)
         throws SAXException {
-        String val = attrs.getValue("target-entity");
+        String val = attrs.getValue("fetch");
+        if (val != null) {
+            fmd.setInDefaultFetchGroup("EAGER".equals(val));
+        }
+        val = attrs.getValue("target-entity");
         if (val != null)
             fmd.getElement().setDeclaredType(classForName(val));
         assertPCCollection(fmd, "OneToMany");



Mime
View raw message