openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r679261 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
Date Thu, 24 Jul 2008 01:36:44 GMT
Author: fancy
Date: Wed Jul 23 18:36:44 2008
New Revision: 679261

URL: http://svn.apache.org/viewvc?rev=679261&view=rev
Log:
OPENJPA-241 Extra SQL on lazy CMR load
commit openjpa_241_1.patch on behalf of Fay Wang

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java?rev=679261&r1=679260&r2=679261&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
Wed Jul 23 18:36:44 2008
@@ -347,15 +347,12 @@
                     ((Collection) coll).iterator().next();
                 OpenJPAStateManager sm1 = (OpenJPAStateManager) pc.
                     pcGetStateManager();
-                FieldMapping[] fms = ((ClassMapping) sm1.getMetaData()).
-                    getDeclaredFieldMappings();
-                for (int i = 0; i < fms.length; i++) {
-                    if (fms[i] == mappedByFieldMapping) {
-                        res.setMappedByValue(sm1.fetchObject(fms[i].
-                            getIndex()));
-                        break;
-                    }
-                } 
+                
+                ClassMapping clm = ((ClassMapping) sm1.getMetaData());
+                FieldMapping fm = (FieldMapping) clm.getField(
+                    mappedByFieldMapping.getName());
+                if (fm == mappedByFieldMapping)
+                    res.setMappedByValue(sm1.fetchObject(fm.getIndex()));
             } else {
                 res.setMappedByValue(null);
             }



Mime
View raw message