I can't set any property to null via a Repository. For example, suppose I have the following entity:
@NodeEntity
class User {
private Long id;
private String name;
}
If this entity already exists in the db with name:"Victor"
, then if I will save it like this:
User savedUser = userRepository.save(user);
The savedUser
will have null
as name. But in the db the name
property will be Victor
.
Any thoughts, why so? And how to set a property to the null
value?
PS: Seems like the key point, why null
's aren't set, may be found in the EntityGraphMapper
:
for (PropertyReader propertyReader : entityAccessStrategy.getPropertyReaders(classInfo)) {
Object value = propertyReader.read(entity);
if (value != null) {
nodeBuilder.addProperty(propertyReader.propertyName(), value);
}
}
Such properties simply aren't taken into account... What should developers do?