Load an object into Neo4j OGM 1.1.3 ogm depth 2 very slowly

I get a timeout when requesting a depth of 2 using session.load() . I am working with Neo4j OGM 1.1.3 (Attempting to migrate from Spring Data Neo4j 3.4). Trying to load a Node object

 class Node { Long id; String name; @Relationship(type="NodeToCategory") Category category; @Realtionship(type="NodeToChildNode") Node node } class Category { Long id; String name; String color; Date createdAt; } 

The category that is associated with my Node is very popular (20,000 nodes have the same category), and when I use run session.load(Node.class, 1L, 2) the request time. Maybe he is trying to query all category relationships (although my Category model in Java ignores this relationship)?

what I would expect from a download is simply:

 |My Node | |category | |child node | | | category | | | child node 

This is not a very difficult request and should not be a timeout (unless it loads unnecessary relationships.

Is there a way to talk about one relationship with a particular relationship?

For example, I would like to download 10 levels of a tree, but other information about my tree (for example, a category, a role that is not really a tree node, but simply represents additional information). I would only like to download them without their relationship. Therefore, I would like to load all Node objects and load only other objects without their links.

UPDATE

found two open problems that seem to address these issues:

https://github.com/neo4j/neo4j-ogm/issues/55

https://github.com/neo4j/neo4j-ogm/issues/70

+6
source share
1 answer

This issue was addressed in OGM 3.0 with schema-based loading.

Schema-based loading means that OGM now scans your domain model, and only selects what is really present in your model, and not everything to the specified depth.

In your case, when Category does not refer to Node , the new version will not load many unnecessary nodes, which will lead to a significant increase in performance.

0
source

All Articles