-
Notifications
You must be signed in to change notification settings - Fork 620
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
@RelationshipProperties support for @Id @GeneratedValue private UUID id; #2620
Comments
Thanks, @MaurizioCasciano that is an excellent topic to talk to. Right now, not yet. This is atm strictly the internal marker we need to keep the rel properties internally identifiable without creating proxies for them. We need to work in this area anyhow as Neo4j 5 deprecated support for Pinging @meistermeier about this too |
I would be interested in the use-case, you are trying to cover by assigning custom ids? I am just trying to figure out how this can benefit SDN. |
Hi @meistermeier, the use-case I am trying to cover is the modeling of unique relationships having an external identifier (String | UUID) without having to maintain multiple IDs in the DB. We could add a property to the relationship (e.g. Considering as an example a list of software licensed to a list of people, there is the need to model the license as a relationship using the existing identifier. (s:Software{id:"9149843d-aef1-4795-8dbd-481ca365c3c6"})-[:License{id:"a915af52-961a-4fc0-a5d6-0f51b601e92e", expiration:"2022-11-01T11:24:58Z"}]->(p:Person{id:"ca33c0b9-e61c-4be3-9105-b21db0a68e2d"}) |
Sorry for losing track of this issue. Unfortunately, I can only repeat ourselves and tell you that it is not this easy to add an alternative id type (like we have in the entities) to |
Hi @meistermeier , related with this, I am having some issues because, as @michael-simons said, with the change from id() to elementId(), it appears a lot of warnings when a relation is saved. I have been able to update nodes from long id to string, but RelationshipProperties fail. |
Could you tell us which version of SDN you are running? If it is SDN 7.1.0 (with Spring Boot 3.1.0) there was a changed introduce that handles |
We are using Spring Boot 2.7.12. Does this version have the changes or Spring Boot 2.7.12 has SDN 6.3.12? |
Even with the Cypher-DSL configuration bean, it appears this error |
@antonydelgado as I understood, even if it's possible to use uuid IDs in Neo4j, spring-data-neo4j does not support it since it relies on the internal ID for object mapping On another note, with Spring Boot 3.2.1 and spring-data-neo4j 7.2.2 I have the same issue as @pabloaguilarm |
You are right about the internal id ( The error message, @pabloaguilarm is referring to, is not covering the |
Hi, thanks for your response. I think that is unnecessary when I use a relational database, but I've used neo4j and I need to export an neural network inmutable for effects of the sequencing process in various businesses where the communication of activities is necessary. So the longs ids could repeat. I've given a solution, I've been going to write validation code in Java and it works but I think that is wrong way, because I think that solution should have come from the SDN, just as it is done in cypher. |
You can just add any value to a The long ids respectively the element ids won't repeat, they are generated by the database. |
Hi, I try to add UUID as a Id in @RelationshipProperties class but ocurre errors when I compile and it doesn't work for me, do you do it like this? and it works for you? |
You need to understand the difference between id/element id on one side and any other property on the other side first. Take a look at this graph: CREATE (a:A {
id: 42,
elementId: 'blah'
})-[r:RELATED_TO {
id: randomUUID()
}]->(b:B {
id: 4711,
elementId: 'foobar'
}) It creates two nodes, with two properties each, and a relationship with one property. MATCH (a:A) -[r:RELATED_TO]->(b:B)
RETURN a.id AS a_id_prop, a.elementId AS a_element_id_prop,
id(a) AS a_id, elementId(a) AS a_element_id,
r.id AS r_id_prop, id(r) as r_id, elementId(r) AS r_element_id; The result will be:
When you do this on your database, the values will be different. What do we see here? there is a difference between a property named id or element id in the graph vs the ids / or modern Neo4j elementIds of elements of the graph. We also do use them to make Nodes addressable in Java, unless - and btw recommend - you use an externally assigned UUID. |
Yeah, for that reason i question, becouse i don't know, but thanks for your time in respond me. Could you please review this code where i try introduce a property id (as you recomend, but in my entity class), as a uuid or String?, but i obtain an error that say " ...for the properties of a relationship is missing a property for the generated, internal ID ( RELATION
NODE A
NODE C
Thanks for read and try help me. |
The
@RelationshipProperties
only supportsCan this be extended to also support the
UUID
type as it is for@Node
annotated classes?The text was updated successfully, but these errors were encountered: