Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Expect disruption to service on Thursday, Feb. 9!

Neo4j SDN 6.3.2 - StackOverflow error when calling "findById" method on large graph

Greetings. As the title states, I'm having trouble with the "findById" method from Neo4jRepository.

In my case, I have a pretty large graph which contains around 6k nodes. The problem comes when I use "findById" to retrieve the information of a single node. As far as I understand, "findById" retrieves not only the node I'm trying to get, but the whole set of  "connected" nodes as well. I've reached a point in which my application fails with a "StackOverFlow" error, which I could infer was caused by a huge query made by SDN (I could tell this by taking a look at the query trace in console).

Now, I just "solved" this problem by increasing the JVM's stack size to 4M. My question is then: is this ok? I mean, it sounds a little bit odd to me having to tweak the default stack size. Also, although this works, some queries take up to 20s to complete..

All in all, is there a way to prevent "findById" from fetching the whole graph every time? I also found out that if I retrieve the node using a custom query, it ends up deleting previous relationships when executing .update(node) method.

It seems like the only way to work with Neo4jRepository's basic operations implies fetching and saving the whole graph each time, resulting in a huge performance loss.

I would appreciate some advice regarding this issue.