-
Notifications
You must be signed in to change notification settings - Fork 617
Spring Data not populating Relationships with ID [DATAGRAPH-1444] #2006
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
Gerrit Meier commented A relationship with properties ( May I ask why you need the identifier? |
Marcos Stival commented Sure Gerrit Meier. In our project the frontend uses Linkurious' Ogma library which needs a unique identifier to place entities and relationships on its canvas and ensure there aren't any duplicates. By using the new Neo4JClient you mean to instead of using Spring's derived queries (findBy....) I should build queries by hand using the client? My business case requires a hierarchical structure between entities, which is represented by a relationship downwards. Actually, I have to traverse it recursively starting at the aggregate root and then accessing each parentOf to create the response I will be returning from the service. // API Response example
{
"code": "ABC1",
"name": "Client A",
"parentOf": [
{
"id": "XYZ987", // Since SDN 6.0.1, "id": "null"
"child": {
"code": "CDE2",
"name": "Client B",
"parentOf": [ ... ]
}
}
]
} |
Gerrit Meier commented I wonder if the example, you have posted matches the behaviour you are facing and assume that the id was a numeric value before, right? |
Marcos Stival commented Wow, I haven't thought about that. Let me check with the frontend team then I will get back to you. Thanks Gerrit Meier ! EDIT: Hey Gerrit Meier, I've just talked with the frontend team. They told me that in principle, there shouldn't be any problem but after thinking a bit we realized that in the case the same edge is returned with a different UUID it could be drawn over as the Ogma library will differentiate them based on their ID. An example query that could return the same edge with different id could be an expandNode endpoint (given a node ID, return its neighbours). If we call this endpoint twice the UUID generated for the relationships will be different (as they are not backed by the database). I'm gonna make a quick PoC locally then come back with the results |
Michael Simons commented Hey, you can of course introduce an actual property.
this will add a graph property named On the domain model you would annotate it with This way, you would have stable identifiers and not have any additional load on the client by calling all those new uuids (Related: http://www.wasteaguid.info ;) ) |
Related to #2118 Id properties will be filled very soon. |
Nice! @michael-simons |
Is this solved for you with the latest version? |
Closing this because there were no new input and the issue seems to be solved in general. |
Marcos Stival opened DATAGRAPH-1444 and commented
After upgrading to Spring Boot 2.4.0 (so using SDN 6.0.1) I got some problems.
There's no
@RelationshipEntity
anymore so I guess in my code I should change it to@RelationshipProperties
.After searching the documentation I can't figure how to make it return the id property of a relationship. +Before the version upgrade, every relationship property was returned correctly, now it doesn't.+
I tried to add a
@Property
annotation to the id field, but an Exception was raised by Spring.The id field is annotated with
@Id
and@GeneratedValue
Affects: 6.0.1 (2020.0.1)
The text was updated successfully, but these errors were encountered: