Skip to content

SDN not creating UUID when saving #2214

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

Closed
mrksph opened this issue Apr 8, 2021 · 1 comment
Closed

SDN not creating UUID when saving #2214

mrksph opened this issue Apr 8, 2021 · 1 comment
Assignees
Labels
type: documentation A documentation update

Comments

@mrksph
Copy link

mrksph commented Apr 8, 2021

Hi,

Spring Boot 2.4.2, SDN 6.0.3

Im trying to save a Node which has an Outgoing Relationship with UUID as its ID.

@RelationshipProperties
@Getter
@Setter
public class TestRelationship {

@Id
@GeneratedValue(generatorClass = UUIDStringGenerator.class)
private UUID uuid:

@TargetNode
private Node child;

}
Node parent = new Node();
Node child = new Node();

TestRelationship testRel = new TestRelationship();
testRel.setChild(child);
parent.setRel(testRel);
repository.save(parent);

This results in the relationship not saving the UUID.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 8, 2021
@michael-simons
Copy link
Collaborator

This is expected behavior. @RelationshipProperties classes are no entities and don't carry externally generated IDs (such as UUIDs). The only supported generated ID value on them is

@Id @GeneratedValue
private Long id;

which corresponds to the id assigned via Neo4j (the database). Quoting the docs (since 6.0.4)

You should define a property for the generated, internal ID so that SDN can determine during save which relationships can be safely overwritten without losing properties. A generated id property is optional in SDN 6.0.4 and upwards and will be required in SDN 6.1 for @RelationshipProperties.

https://docs.spring.io/spring-data/neo4j/docs/6.0.7/reference/html/#mapping.annotations.relationship.properties

@michael-simons michael-simons added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 8, 2021
@michael-simons michael-simons added this to the 6.0.8 (2020.0.8) milestone Apr 8, 2021
@michael-simons michael-simons self-assigned this Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

3 participants