Skip to content
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

RealtionshipId with Long type throws warning switching to UUID is not allowed #2779

Open
NilsWild opened this issue Aug 18, 2023 · 4 comments
Assignees
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@NilsWild
Copy link

When defining RelationshipProperties we have to add an Long id field in order to keep track of that relationship. So far so good. With the changes in SDN UUIDs etc. are the way to go for Nodes. However this doesn't seem to be the case for RelationshipProperties. However the Neo4jPersistentEntity throws warnings:

RelationshipProperties is using a Long value for storing internally generated Neo4j ids. The Neo4j internal Long Ids are deprecated, please consider using an external ID generator.

We should be able to switch to a different Generator for the Id field of RelationshipProperties.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 18, 2023
@meistermeier
Copy link
Collaborator

You should be able to use String instead of Long type for ids. The annotation(s) will be the same.

@RelationshipId
private String id;

This is related to the switch from (long) id to (String) elementId as the main internal type of the database itself. When we introduced the support for this type, we also took care to warn the users if they are still using longs for the identifiers.
There is no need (and functionality in SDN) to introduce a custom generated id value here. The message is misleading in this case and should get improved.

@meistermeier meistermeier self-assigned this Aug 21, 2023
@NilsWild
Copy link
Author

Ah I see. Thank you. The documentation also only shows the Long option and doesnt mention anything about String ids i think.

@GregDThomas
Copy link
Contributor

Note; we just hit this issue and tried to make the change - all our code broke.

It turns out you can't use String RelationshipIds with Neo4j 4.x even though you get the the warning about using a Long RelationshipId. If you do, the relationships are lost.

To summarise;
Neo4j 4.x: Use Long RelationshipIds only - ignore the warning
Neo4j 5.x: Use a Long or String RelationshipId
Neo4j 6.x: Use String RelationshipIds only

@rugbroed
Copy link

I'm also having this issue. It breaks the consistency of the domain not being able to specify the Generator used for RelationshipProperties.

In my case, I would like to use UUID's from the domain perspective (pojos).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

5 participants