openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r956883 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java
Date Tue, 22 Jun 2010 13:31:02 GMT
Author: dwoods
Date: Tue Jun 22 13:31:01 2010
New Revision: 956883

URL: http://svn.apache.org/viewvc?rev=956883&view=rev
Log:
OPENJPA-1700 FindBugs - Inefficient use of keySet iterator instead of entrySet iterator. 
Also, inefficient use of temporary Map when results can be used immediately

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

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java?rev=956883&r1=956882&r2=956883&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java
Tue Jun 22 13:31:01 2010
@@ -88,22 +88,17 @@ public class MixedLockManager extends Pe
         // 
         if(!dict.supportsLockingWithMultipleTables) {
             // look for columns mapped to secondary tables which need to be locked
-            Map<DBIdentifier,FieldMapping> colsMappedToSecTable = new HashMap<DBIdentifier,FieldMapping>();
             FieldMapping fms[] = mapping.getFieldMappings();
             for( FieldMapping fm : fms) {
                 DBIdentifier secTableName = fm.getMappingInfo().getTableIdentifier();
-                if(!DBIdentifier.isNull(secTableName)) {
-                    colsMappedToSecTable.put(secTableName, fm);
+                if (!DBIdentifier.isNull(secTableName)) {
+                    // select only the PK columns, since we just want to lock
+                    Select select = factory.newSelect();
+                    select.select(fm.getColumns());
+                    select.whereForeignKey(fm.getJoinForeignKey(), id, mapping, _store);
+                    sqls.add(select.toSelect(true, fetch));
                 }
             }
-            for( DBIdentifier secTableName : colsMappedToSecTable.keySet()) {
-                FieldMapping fm = colsMappedToSecTable.get(secTableName);
-                // select only the PK columns, since we just want to lock
-                Select select = factory.newSelect();
-                select.select(fm.getColumns());
-                select.whereForeignKey(fm.getJoinForeignKey(), id, mapping, _store);
-                sqls.add(select.toSelect(true, fetch));
-            }
         }
         return sqls;
     }



Mime
View raw message