You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently the neo4jTemplate.save method saves the whole sub graph provided. This makes it hard to just create or update a single node which has relations to other nodes.
Request:
Adding a method e.g. neo4jTemplate.saveJust(node) which will create/update just the provided node and the relations to other nodes. Instead of also creating related nodes it will expect the related nodes to already exist and fail if this it not the case.
So basically the same logic as the current save method explained in the docs: Appendix -> Query Creation but with a modified step 3 and without step 5.
Current solution:
My current solution is to use projections for the node classes I want to save. E.g. I have a User-Node and Post-Node and when adding a new Post I want to link it with the user who posted the post:
When using neo4jTemplate.saveAs(node, PostProjection.class) I get the expected result that just the post and relation to the user is created without the user being modified.
Motivation:
I think that creating/updating a single node is a general use case and with the current solution I have to create projection interface for almost every node-class which exactly following the same schema:
Every projection interface contains getter for all properties, plus getters with IdProjection for all relationships.
From my point of view this is very much boilerplate code and makes the project harder to maintain as adding new fields requires updating the node class and the projection class.
The text was updated successfully, but these errors were encountered:
currently the
neo4jTemplate.save
method saves the whole sub graph provided. This makes it hard to just create or update a single node which has relations to other nodes.Request:
Adding a method e.g.
neo4jTemplate.saveJust(node)
which will create/update just the provided node and the relations to other nodes. Instead of also creating related nodes it will expect the related nodes to already exist and fail if this it not the case.So basically the same logic as the current
save
method explained in the docs: Appendix -> Query Creation but with a modified step 3 and without step 5.Current solution:
My current solution is to use projections for the node classes I want to save. E.g. I have a User-Node and Post-Node and when adding a new Post I want to link it with the user who posted the post:
My projections look like this:
When using
neo4jTemplate.saveAs(node, PostProjection.class)
I get the expected result that just the post and relation to the user is created without the user being modified.Motivation:
I think that creating/updating a single node is a general use case and with the current solution I have to create projection interface for almost every node-class which exactly following the same schema:
Every projection interface contains getter for all properties, plus getters with
IdProjection
for all relationships.From my point of view this is very much boilerplate code and makes the project harder to maintain as adding new fields requires updating the node class and the projection class.
The text was updated successfully, but these errors were encountered: