diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java index 558e8569e..f6d3f5968 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.openjpa.jdbc.meta.ClassMapping; import org.apache.openjpa.jdbc.meta.FieldMapping; @@ -318,11 +319,13 @@ public class PreparedQueryImpl implements PreparedQuery { } Map result = new HashMap(_template); - for (Object key : user.keySet()) { + Set> userSet = user.entrySet(); + for (Map.Entry userEntry : userSet) { + Object key = userEntry.getKey(); int[] indices = _userParamPositions.get(key); if (indices == null || indices.length == 0) throw new UserException(_loc.get("uparam-no-pos", key, this)); - Object val = user.get(key); + Object val = userEntry.getValue(); if (ImplHelper.isManageable(val)) { setPersistenceCapableParameter(result, val, indices, broker); } else if (val instanceof Collection) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java index 286221bc6..d0d0e2426 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedSQLStoreQuery.java @@ -23,6 +23,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; +import java.util.Set; import org.apache.openjpa.jdbc.kernel.exps.ExpContext; import org.apache.openjpa.jdbc.kernel.exps.QueryExpressionsState; @@ -153,9 +154,11 @@ public class PreparedSQLStoreQuery extends SQLStoreQuery { */ public Object[] toParameterArray(StoreQuery q, Map userParams) { Object[] array = new Object[userParams.size()]; - for (Object key : userParams.keySet()) { - int idx = ((Integer)key).intValue(); - array[idx] = userParams.get(key); + + Set> userSet = userParams.entrySet(); + for (Map.Entry userEntry : userSet) { + int idx = ((Integer)userEntry.getKey()).intValue(); + array[idx] = userEntry.getValue(); } return array; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/VersionMappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/VersionMappingInfo.java index 60f9e840a..589497eba 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/VersionMappingInfo.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/VersionMappingInfo.java @@ -91,10 +91,13 @@ public class VersionMappingInfo } MappingDefaults def = vers.getMappingRepository().getMappingDefaults(); List result = new ArrayList(); - for (Table table : assign.keySet()) { - List cols = assign.get(table); - Column[] partTemplates = cols.toArray(new Column[cols.size()]); - def.populateColumns(vers, table, partTemplates); + + Set>> assignSet = assign.entrySet(); + for (Map.Entry> assignEntry : assignSet) { + Table table = assignEntry.getKey(); + List cols = assignEntry.getValue(); + Column[] partTemplates = cols.toArray(new Column[cols.size()]); + def.populateColumns(vers, table, partTemplates); result.addAll(Arrays.asList(createColumns(vers, null, partTemplates, table, adapt))); }