openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r654658 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java
Date Fri, 09 May 2008 00:13:48 GMT
Author: fancy
Date: Thu May  8 17:13:48 2008
New Revision: 654658

URL: http://svn.apache.org/viewvc?rev=654658&view=rev
Log:
OPENJPA-589 Can not retrieve M-to-M data when DataCache is on
committing patch provided by Fay Wang

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java?rev=654658&r1=654657&r2=654658&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java
Thu May  8 17:13:48 2008
@@ -87,16 +87,20 @@
                 Map m = (Map) data;
                 Map m2 = (Map) sm.newFieldProxy(fmd.getIndex());
                 Collection keys = new ArrayList (m.size());
+                Collection values = new ArrayList(m.size());          
 
-                for (Iterator mi = m.entrySet().iterator(); mi.hasNext();)
-                    keys.add(mi.next());
+                for (Iterator<Map.Entry> mi = m.entrySet().iterator();
+                    mi.hasNext();) {
+                    Map.Entry e = mi.next();
+                    keys.add(e.getKey());
+                    values.add(e.getValue());
+                }
 
                 Object[] keyArray = keys.toArray();
-                Object[] values = toNestedFields(sm, fmd.getElement(),
-                    keys, fetch, context).toArray();
-                int idx = 0;
-                for (Iterator mi = m.entrySet().iterator(); mi.hasNext(); idx++)
-                    m2.put(keyArray[idx], values[idx]);
+                Object[] valueArray = toNestedFields(sm, fmd.getElement(),
+                    values, fetch, context).toArray();
+                for (int idx = 0; idx < keyArray.length; idx++)
+                    m2.put(keyArray[idx], valueArray[idx]);
 
                 return m2;
             case JavaTypes.ARRAY:



Mime
View raw message