-
Notifications
You must be signed in to change notification settings - Fork 620
Closed
Labels
type: bugA general bugA general bug
Description
SDN does not respect default values set in entities. This differs from OGM's behavior.
For example, say you have an entity like this
@Getter
@Setter
@Node
public abstract class MyNode {
@Property("name")
private String name;
@Property("active")
private boolean active = true;
@Property("age")
private Integer age = 25;
}
And you create a new node without the active and age properties
CREATE (:MyNode {id: '123', name: 'Nikola Tesla'})
When you query for the node, active will be false and age will be null
MyNode found = myNodeRepository.findById("123").get();
if (!found.isActive()) { // active is false but it should be true
found.setAge(found.getAge() - 1); // age is null: NullPointerException
}
As far as I know, this example has never worked correctly in SDN. Specifically I tried this with 6.3.1 and 6.2.0 and saw the same behavior.
However, this differs from OGM, which uses the default values set in an entity. The tests in this project would pass if run using OGM.
This seems similar to #2348
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug