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.
This commit is contained in:
Oliver Gierke
2018-07-13 16:50:06 +02:00
parent 9991946d92
commit 95d316367b
2 changed files with 19 additions and 0 deletions

View File

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

View File

@@ -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<T> extends BasicPersistentEntity<T, Relatio
public String toString() {
return String.format("JdbcPersistentEntityImpl<%s>", getType());
}
/*
* (non-Javadoc)
* @see org.springframework.data.mapping.model.BasicPersistentEntity#setPersistentPropertyAccessorFactory(org.springframework.data.mapping.model.PersistentPropertyAccessorFactory)
*/
@Override
public void setPersistentPropertyAccessorFactory(PersistentPropertyAccessorFactory factory) {
}
}