-
Notifications
You must be signed in to change notification settings - Fork 166
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
Treat composite keys correct during load and save operations. #790
Merged
Conversation
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
Primary keys having a `CompositeAttributeConverter` have not been taking into consideration when saving and loading: The map would be used as "the" value for the id. That would might work when the map would be converted by the drivers, but the queries would not match anything due to the fact that no keys in the map are compared. This commit changes this by creating an inline cypher map from the properties that are matched on during load and written during save as well. This fixes #789.
meistermeier
requested changes
Apr 21, 2020
...j-ogm-tests/neo4j-ogm-integration-tests/src/test/java/org/neo4j/ogm/domain/gh789/Entity.java
Outdated
Show resolved
Hide resolved
All joining and split operations of composite keys have been moved into `NodeQueryStatements`. This is not an optimal place, but much better than distributing it all over the interfaces. We cannot find an optimal place due to the way things are packaged.
Codecov Report
@@ Coverage Diff @@
## master #790 +/- ##
============================================
- Coverage 80.39% 80.32% -0.08%
- Complexity 3003 3015 +12
============================================
Files 275 275
Lines 9181 9218 +37
Branches 1363 1377 +14
============================================
+ Hits 7381 7404 +23
- Misses 1299 1310 +11
- Partials 501 504 +3
Continue to review full report at Codecov.
|
This allows properties in @CompositeIndex to be prefixed with `fieldName.` so that the auto index manager can recognize indexes belonging to fields that are decomposed by a map composite converter. We also log a big warning in case a field is to be decomposed but doesn’t carry a composite index but a normal one.
michael-simons
force-pushed
the
issue/789
branch
from
April 21, 2020 12:32
2cf37f0
to
f8f8200
Compare
michael-simons
added a commit
that referenced
this pull request
Apr 22, 2020
This change has a couple of aspects: = Unwrap composite keys during load and save. Primary keys having a `CompositeAttributeConverter` have not been taking into consideration when saving and loading: The map would be used as "the" value for the id. That would might work when the map would be converted by the drivers, but the queries would not match anything due to the fact that no keys in the map are compared. This commit changes this by creating an inline cypher map from the properties that are matched on during load and written during save as well. This fixes #789. = Make the AutoIndexManager aware of decomposed fields. This allows properties in @CompositeIndex to be prefixed with `fieldName.` so that the auto index manager can recognize indexes belonging to fields that are decomposed by a map composite converter. We also log a big warning in case a field is to be decomposed but doesn’t carry a composite index but a normal one.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please have a look at the message of the first commit for reasoning.