-
Notifications
You must be signed in to change notification settings - Fork 616
'findByProperty' not finishing. It tries to load whole graph #2137
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
Comments
Hi.
I assume that the |
Hi @meistermeier, Yes, you're right. My assumptions were wrong. To reproduce the behavior I must add another relationship to the example Country entity. The missing relationship is between two Countries, DEPENDENCY_OF is like "A Country that depends on another Country". So when querying by "findByCode" the generated query uses both Relationships types to hydrate the fields. The HAS_CURRENCY is not a problem because the Target node is of another type. The problem is with the DEPENDENCY_OF relationship, as the target node is the same type of the source node. The generated query uses an OR operator without a direction arrow so the resultant query tries to load the whole graph.
(dependentCountry:Country)-[DEPENDENCY_OF]->(parentCountry:Country) Also: (country:Country)-[HAS_CURRENCY]->(currency:Currency) |
This mitigates the data that is generated in the database's memory upfront returning. Otherwise this could lead to un-responsive applications.
This mitigates the data that is generated in the database's memory upfront returning. Otherwise this could lead to un-responsive applications.
This mitigates the data that is generated in the database's memory upfront returning. Otherwise this could lead to un-responsive applications.
We changed the path-based queries now to cascading matches. It will still look for everything that is reachable with the given domain model but returns a result (#2140) |
Hi Gerrit, I think this Issue raised another Bug. The cascading matches (I think those are the OPTIONALs MATCHes I've been encountering with) is making ours findByProperties queries very slow. |
Uh oh!
There was an error while loading. Please reload this page.
Spring Boot: 2.4.2
I have the following Model:
Note: A HAS_CURRENCY example: (Country) - [HAS CURRENCY] -> (Currency)
If I do countryRepository.findByCode("CODE"), Spring Data executes the following query
Expected Behavior:
I expect countryRepository.findByCode("CODE") to return the Country with the given "CODE" and its Currencies.
Actual Behavior:
The actual behavior is that Spring Data Neo4j tries to load the whole graph. I think that is because when Spring Data generates the query, it won't add the direction in the second depth level.
How it is:
How it should be:
The text was updated successfully, but these errors were encountered: