DATAGRAPH-368 Handle transient property on detached entity.

In DetachedEntityState.setValue(), check if the property
to save exists on the Neo4jPersistentEntity instance.
If the property is marked transient, the property won't exist
on the entity. In that case, forward the request to the delegate.
This commit is contained in:
Johannes Mockenhaupt
2013-07-13 15:11:43 +02:00
parent 8d6dd38ffb
commit 6fa76bad3a

View File

@@ -137,7 +137,11 @@ public class DetachedEntityState<STATE> implements EntityState<STATE> {
}
@Override
public Object setValue(final Field field, final Object newVal, MappingPolicy mappingPolicy) {
return setValue(property(field),newVal, mappingPolicy);
Neo4jPersistentProperty property = property(field);
if (property != null) {
return setValue(property, newVal, mappingPolicy);
}
return delegate.setValue(property, newVal, mappingPolicy);
}
private Neo4jPersistentProperty property(Field field) {