-
Notifications
You must be signed in to change notification settings - Fork 617
Getting warning about the deprecated id() function when using the @Id annotation. #2716
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
The |
Thanks for the help @meistermeier! :) |
…he users datamodel. This change makes use of the Cypher-DSL dialect capatibilities and uses a String identifier internally for all objects. This will be the `elementId()` on Neo4j 5 and higher and `toString(id())` on Neo4j 4 and lower. Unless explicitly configured by the user through having `@Id @GeneratedValue long id`, we don’t use the `id()` function anymore. This function has been deprecated in Neo4j 5. Users are encouraged to use `@Id @GeneratedValue String id` for assigning the element id as object id or using custom unique identifiers or `@Id @GeneratedValue UUID id` or `@Id @GeneratedValue(value = UUIDStringGenerator.class) String id` for UUIDs. We marked the long ids as deprecated, but don’t have any plans for now to remove them, so that future SDN versions will still be compatible with older Neo4j versions if the data model contains long ids. We opted for using String’s directly to avoid tons of additional instances and rely on the JVMs excellent String caching capatiblities, thus, the `ElementId` interface - not usable so far anyhow - has been removed without current or planned replacement. See #2716 and other tickets, closes #2718.
helped to eliminate the warning. From here. |
@meistermeier Why was the need introduced to switch from id to elementId ? Just was curious! |
@Zaidtech Spring Data Neo4j just supports this new identifier type. The warnings, you are observing are coming directly from the database (Cypher) and are passed through to SDN. We did not introduce this but want our users to have support for (legacy) id and elementId without any breaking API. |
I am using the Neo4jRepository and @node entity with @id and @relationship to another node entity and getting an error saying:
023-05-02 00:59:57.789 WARN 17384 --- [ main] org.springframework.data.neo4j.cypher : Neo.ClientNotification.Statement.FeatureDeprecationWarning: This feature is deprecated and will be removed in future versions. OPTIONAL MATCH (hlp:
Customer) WHERE id(hlp) = $__id__ WITH hlp WHERE hlp IS NULL CREATE (customer:
Customer) SET customer = $__properties__ RETURN customer UNION MATCH (customer:
Customer) WHERE id(customer) = $__id__ SET customer += $__properties__ RETURN customer ^ The query used a deprecated function. ('id' is no longer supported)
I am assuming this is due to the @id annotation which is internally using deprecated function, so is there any planned release for this fix?
The text was updated successfully, but these errors were encountered: