Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order properties when creating a node #2866

Open
lmorel3 opened this issue Feb 21, 2024 · 0 comments
Open

Order properties when creating a node #2866

lmorel3 opened this issue Feb 21, 2024 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@lmorel3
Copy link

lmorel3 commented Feb 21, 2024

Hello,

I'm looking for a way to order node properties when creating new nodes.
My goal is to optimize our queries by reducing the number of DB hits, so the properties order matters a lot.

My code looks like the following:

@Data
@Node("Node")
public class Node {
    String nodeId;
    String description:
    String stuff;
    String reference;
    String title;

     // relationships here
}

interface NodeProjection {
    getNodeId();
    getDescription();
    getStuff();
    getReference();
    getTitle();
}

List<Node> nodes = ....
neo4jTemplate.saveAllAs(nodes, NodeProjection.class)

It results in creating nodes, like this one :

{
    "description": "",
    "nodeId": "",
    "title": "",
    "reference": "",
    "stuff": ""
}

As you can see, properties are randomly ordered. So, how does Neo4JTemplate internally serialize those attributes?
I've tried to used @JsonPropertyOrder but I has no effect.

Regards,
Laurent

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants