OPENJPA-1599 - Retain em method user input property map content from modifications.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.0.x@927630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Albert Lee 2010-03-25 22:53:14 +00:00
parent 7382ba2f84
commit d81cbbd8bb
1 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -487,6 +488,7 @@ public class EntityManagerImpl
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T find(Class<T> cls, Object oid, LockModeType mode, Map<String, Object> properties) { public <T> T find(Class<T> cls, Object oid, LockModeType mode, Map<String, Object> properties) {
assertNotCloseInvoked(); assertNotCloseInvoked();
properties = cloneProperties(properties);
configureCurrentCacheModes(pushFetchPlan(), properties); configureCurrentCacheModes(pushFetchPlan(), properties);
configureCurrentFetchPlan(getFetchPlan(), properties, mode, true); configureCurrentFetchPlan(getFetchPlan(), properties, mode, true);
try { try {
@ -1186,6 +1188,7 @@ public class EntityManagerImpl
assertNotCloseInvoked(); assertNotCloseInvoked();
assertValidAttchedEntity(LOCK, entity); assertValidAttchedEntity(LOCK, entity);
_broker.assertActiveTransaction(); _broker.assertActiveTransaction();
properties = cloneProperties(properties);
configureCurrentCacheModes(pushFetchPlan(), properties); configureCurrentCacheModes(pushFetchPlan(), properties);
configureCurrentFetchPlan(getFetchPlan(), properties, mode, false); configureCurrentFetchPlan(getFetchPlan(), properties, mode, false);
try { try {
@ -1808,4 +1811,11 @@ public class EntityManagerImpl
} }
return value; return value;
} }
private Map<String, Object> cloneProperties(Map<String, Object> properties) {
if (properties != null) {
properties = new HashMap<String, Object>(properties);
}
return properties;
}
} }