[OPENJPA-2834] ensure setProperty invalid properties cache in em

This commit is contained in:
Romain Manni-Bucau 2020-09-30 13:43:55 +02:00
parent 758b866706
commit 4a546f759c
2 changed files with 6 additions and 3 deletions

View File

@ -281,9 +281,11 @@ public class EntityManagerFactoryImpl
OpenJPAEntityManagerSPI em = newEntityManagerImpl(broker);
// allow setting of other bean properties of EM
Set<Map.Entry> entrySet = props.entrySet();
for (Map.Entry entry : entrySet) {
em.setProperty(entry.getKey().toString(), entry.getValue());
if (!props.isEmpty()) {
Set<Map.Entry> entrySet = props.entrySet();
for (Map.Entry entry : entrySet) {
em.setProperty(entry.getKey().toString(), entry.getValue());
}
}
if (canCacheGetProperties) {
if (emEmptyPropsProperties == null) {

View File

@ -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);