diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java index 0c8ff9aec..ff06de691 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java @@ -281,9 +281,11 @@ public class EntityManagerFactoryImpl OpenJPAEntityManagerSPI em = newEntityManagerImpl(broker); // allow setting of other bean properties of EM - Set entrySet = props.entrySet(); - for (Map.Entry entry : entrySet) { - em.setProperty(entry.getKey().toString(), entry.getValue()); + if (!props.isEmpty()) { + Set entrySet = props.entrySet(); + for (Map.Entry entry : entrySet) { + em.setProperty(entry.getKey().toString(), entry.getValue()); + } } if (canCacheGetProperties) { if (emEmptyPropsProperties == null) { diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java index 978241230..1a171ddc5 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java @@ -2121,6 +2121,7 @@ public class EntityManagerImpl */ @Override public void setProperty(String prop, Object value) { + properties = null; if (!setKernelProperty(this, prop, value)) { if (!setKernelProperty(this.getFetchPlan(), prop, value)) { Log log = getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);