First of all, your observation is right: Loading just the node and persisting it, although it would have relationships, would lead to the removal of relationships on save.
This is all written in the documentation: Query creation
But there is a solution to this problem called projections. This means you create a projection of your entity without any relationships, for example. SDN will then not check those relationships on load or save operations.
Of course, and this is something for what we initially introduced the projection support, you could also use this to load the data. Given a ProjectedEntity
as the projection of your entity class.
List<ProjectedEntity> findByIdentifier(String identifier);
Would create and execute the query matching only the properties and relationships defined in the ProjectedEntity
interface/class.