Browse Source

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.
pull/76/merge
Oliver Gierke 8 years ago
parent
commit
95d316367b
No known key found for this signature in database
GPG Key ID: 6E42B5787543F690
  1. 9
      src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java
  2. 10
      src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java

9
src/main/java/org/springframework/data/relational/core/mapping/BasicRelationalPersistentProperty.java

@ -130,6 +130,15 @@ class BasicRelationalPersistentProperty extends AnnotationBasedPersistentPropert @@ -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());
}

10
src/main/java/org/springframework/data/relational/core/mapping/RelationalPersistentEntityImpl.java

@ -18,6 +18,7 @@ package org.springframework.data.relational.core.mapping; @@ -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 @@ -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) {
}
}

Loading…
Cancel
Save