From 95d316367b983fafefc261a30e6434ebbce53ee3 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Fri, 13 Jul 2018 16:50:06 +0200 Subject: [PATCH] DATAJDBC-232 - Adapt code to changes to support immutable entities. We now treat all properties of an entity mutable and continue to use the reflective PersistentPropertyAccessor implementation to make sure we don't break the old behavior of reflectively mutating immutable objects. This is a workaround for now and has to be replaced by more exhaustive changes later. Related tickets: DATACMNS-1322. --- .../mapping/BasicRelationalPersistentProperty.java | 9 +++++++++ .../core/mapping/RelationalPersistentEntityImpl.java | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java b/src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java index 0f747dc24..19d553fee 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java @@ -130,6 +130,15 @@ class BasicRelationalPersistentProperty extends AnnotationBasedPersistentPropert return isListLike(); } + /* + * (non-Javadoc) + * @see org.springframework.data.mapping.model.AbstractPersistentProperty#isImmutable() + */ + @Override + public boolean isImmutable() { + return false; + } + private boolean isListLike() { return isCollectionLike() && !Set.class.isAssignableFrom(this.getType()); } diff --git a/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java index ce9474ef5..b2c5e0549 100644 --- a/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java +++ b/src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java @@ -18,6 +18,7 @@ package org.springframework.data.relational.core.mapping; import java.util.Optional; import org.springframework.data.mapping.model.BasicPersistentEntity; +import org.springframework.data.mapping.model.PersistentPropertyAccessorFactory; import org.springframework.data.util.Lazy; import org.springframework.data.util.TypeInformation; @@ -73,4 +74,13 @@ class RelationalPersistentEntityImpl extends BasicPersistentEntity", getType()); } + + /* + * (non-Javadoc) + * @see org.springframework.data.mapping.model.BasicPersistentEntity#setPersistentPropertyAccessorFactory(org.springframework.data.mapping.model.PersistentPropertyAccessorFactory) + */ + @Override + public void setPersistentPropertyAccessorFactory(PersistentPropertyAccessorFactory factory) { + + } }