diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java index d59764895..9dd208583 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java @@ -21,7 +21,6 @@ package org.apache.openjpa.jdbc.meta.strats; import java.sql.*; import java.util.*; -import org.apache.openjpa.enhance.PersistenceCapable; import org.apache.openjpa.jdbc.identifier.DBIdentifier; import org.apache.openjpa.jdbc.kernel.*; import org.apache.openjpa.jdbc.meta.*; @@ -215,11 +214,8 @@ public class HandlerHandlerMapTableFieldStrategy for (Iterator itr = change.iterator(); itr.hasNext();) { mkey = itr.next(); - Object mval = map.get(mkey); - if ((mval instanceof PersistenceCapable) && !((PersistenceCapable)mval).pcIsDirty()) - continue; HandlerStrategies.where(key, mkey, store, changeRow, _kcols); - HandlerStrategies.set(val, mval, store, changeRow, + HandlerStrategies.set(val, map.get(mkey), store, changeRow, _vcols, _vio, true); rm.flushSecondaryRow(changeRow); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java index b764988ac..8fe46ab36 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java @@ -26,8 +26,6 @@ import java.util.Map; import java.util.Iterator; import java.util.Set; -import org.apache.openjpa.enhance.PersistenceCapable; - /** * Utility methods used by map proxies. * @@ -85,6 +83,9 @@ public class ProxyMaps /** * Call after invoking {@link Map#get} on super. + * The potential change is tracked when the get method is called. This change + * will not translated to an update statement if the retrieved value + * is not dirty. * * @param ret the return value from the super's method * @param before the return value from {@link #beforeGet} @@ -93,10 +94,10 @@ public class ProxyMaps public static Object afterGet(ProxyMap map, Object key, Object ret, boolean before) { if (before) { - if (map.getChangeTracker() != null && (ret instanceof PersistenceCapable)) + if (map.getChangeTracker() != null) ((MapChangeTracker) map.getChangeTracker()).changed(key, ret, ret); - } + } return ret; }