-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Avoid all usage of Neo4j id() function unless required by t…
…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.
- Loading branch information
1 parent
fca0a9a
commit d8bff18
Showing
31 changed files
with
1,760 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
# Run with | ||
# ./mvnw org.openrewrite.maven:rewrite-maven-plugin:dryRun \ | ||
# -Drewrite.checkstyleDetectionEnabled=false \ | ||
# -Drewrite.configLocation=etc/migrate-to-element-id.yml \ | ||
# -Drewrite.activeRecipes=sdn.elementId.rewriteIdCalls | ||
--- | ||
type: specs.openrewrite.org/v1beta/recipe | ||
name: sdn.elementId.rewriteIdCalls | ||
displayName: Change calls to Functions.id to Functions.elemenetId | ||
recipeList: | ||
- org.openrewrite.java.ChangeMethodName: | ||
methodPattern: org.neo4j.cypherdsl.core.Functions id(..) | ||
newMethodName: elementId | ||
ignoreDefinition: true |
165 changes: 81 additions & 84 deletions
165
src/main/java/org/springframework/data/neo4j/core/Neo4jTemplate.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.