-
Notifications
You must be signed in to change notification settings - Fork 617
Spring-data-neo4j Custom Query Mapping return incomplete Relationships. #2600
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
Misses dynamic relationships right now.
Thanks for reporting this issue. The logic is currently that already hydrated list will not get populated again. The result pattern of the generated queries is different. That's why they are working as expected.
|
Thanks for the anwser ! It works.
It works as expected. Is there any way to move it into projectionDto ? It make my domain entity confusing . Because i need it only when i query, I don't want someone to accidentally use it at save operation. |
When i change version to 6.3.4-GH-2600-SNAPSHOT. @repository |
Obviously the question comes up: About how many relationships are we talking a few hundreds or more than 10.000? For the other question: Projections are Entity bound. So at least you would have to use the defining entity as the projection base and add only the relationship. |
Almost a thousand when i tried. When i used Projections, ProjectionDto like this.
I want to collection bidirection relationship when i query.
Relationships can't be iterable. I can't collect relationships in projectionDto. And Relationships information lose when i use projection. I can't find any example or doc to achieve this .
|
I just updated the snapshot so it does not run into a StackOverflow (with our tests and an interpretation of you scenario of what might cause it). Would be great to get feedback. It took some time and is still a WIP, but I wanted to have a solid build that should now avoid following known relationships again and again (StackOverflow). For the projection part: If you want to create something that is more like a wrapper for arbitrary values (and domain objects), you might get better -depending on the data model- results if you would do the mapping (partial) manually and use the |
I got your point . |
Thank you very much for the fast feedback on this topic. I will reopen this issue for tracking purposes because there is still work to do on the branch before we can merge it. |
Misses dynamic relationships right now. Closes #2600
graph like this.
domain like this .
when i used @query to custom query ,the relationship in the node is incomplete .
when i used findAll in CrudRepository ,the result is correct .
Custom Query like this .
personRepository.customQuery() that will return like
Human{name='employee-0', birth=2022-09-29T14:35:27.692236500, callList=0, beCallList=2}
Human{name='employee-1', birth=2021-09-29T14:35:27.692236500, callList=0, beCallList=2}
Human{name='employee-2', birth=2020-09-29T14:35:27.692236500, callList=0, beCallList=2}
Human{name='employee-3', birth=2019-09-29T14:35:27.692236500, callList=0, beCallList=2}
Human{name='employee-4', birth=2018-09-29T14:35:27.692236500, callList=0, beCallList=2}
Human{name='boss', birth=2022-09-29T14:35:27.969232, callList=2, beCallList=0}
=========
personRepository.findAll()will return like
missing 8 relationship at customQuery .but two query return record is same.
Why did this happen.
When i use Neo4jClient,I also encounter this problem.
Is this a bug ,or I do something wrong ?
btw.
How can i move code (
@relationship(type = "CALL_TO", direction = Relationship.Direction.INCOMING)
private List beCallList; )
into projection? I need it only for querying
here is my example
https://github.com/Qingsx/neo4j-bug-reproduce.git
The text was updated successfully, but these errors were encountered: