DATAGRAPH-356 Handle transient fields consistently with Spring Data & SD Rest
This commit is contained in:
@@ -78,7 +78,10 @@ public class DetachedEntityState<STATE> implements EntityState<STATE> {
|
||||
|
||||
@Override
|
||||
public Object getValue(Neo4jPersistentProperty property, MappingPolicy mappingPolicy) {
|
||||
mappingPolicy = mappingPolicy == null ? property.getMappingPolicy() : mappingPolicy;
|
||||
if (mappingPolicy == null) {
|
||||
if (property!=null) mappingPolicy = property.getMappingPolicy();
|
||||
else mappingPolicy = MappingPolicy.MAP_FIELD_DIRECT_POLICY;
|
||||
}
|
||||
if (isDetached()) {
|
||||
if (template.getPersistentState(getEntity())==null || isDirty(property)) {
|
||||
if (log.isDebugEnabled()) log.debug("Outside of transaction, GET value from field " + property);
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty;
|
||||
public class TransientFieldAccessorFactory implements FieldAccessorFactory {
|
||||
@Override
|
||||
public boolean accept(final Neo4jPersistentProperty property) {
|
||||
return property.isReallyTransient();
|
||||
return property.isTransient();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,8 +84,6 @@ public interface Neo4jPersistentProperty extends PersistentProperty<Neo4jPersist
|
||||
|
||||
MappingPolicy getMappingPolicy();
|
||||
|
||||
boolean isReallyTransient();
|
||||
|
||||
Object getValueFromEntity(Object entity, MappingPolicy mappingPolicy);
|
||||
|
||||
<T> T getDefaultValue(ConversionService conversionService, final Class<T> targetType);
|
||||
|
||||
@@ -348,12 +348,8 @@ class Neo4jPersistentPropertyImpl extends AnnotationBasedPersistentProperty<Neo4
|
||||
return MappingPolicy.DEFAULT_POLICY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated todo remove when SD-Commons handles transient properties differently
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isReallyTransient() {
|
||||
return Modifier.isTransient(field.getModifiers()) || isAnnotationPresent(Transient.class) || isAnnotationPresent("javax.persistence.Transient");
|
||||
public boolean isTransient() {
|
||||
return super.isTransient() || Modifier.isTransient(field.getModifiers()); // || isAnnotationPresent(Transient.class) || isAnnotationPresent("javax.persistence.Transient");
|
||||
}
|
||||
|
||||
private boolean isAnnotationPresent(String className) {
|
||||
@@ -363,11 +359,6 @@ class Neo4jPersistentPropertyImpl extends AnnotationBasedPersistentProperty<Neo4
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransient() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends TypeInformation<?>> getPersistentEntityType() {
|
||||
final Iterable<? extends TypeInformation<?>> result = super.getPersistentEntityType();
|
||||
|
||||
Reference in New Issue
Block a user