-
Notifications
You must be signed in to change notification settings - Fork 617
Renamed properties are not included during writes and not projected during reads. #2371
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
First analysis (unfortunately no solution yet):
I would like to investigate option 2 with an external "alternative property name provider" approach. |
It seems that option 2 is a valid one and does not too much influence the existing code base or make it unnecessary complex. |
@Property
information in projection.Domain attributes can be renamed using the `@Property` annotation when being mapped to and read from graph properties. That renaming must also happening when using projections. As with #2451 in 582fd7d this is kind of a problem with the existing filter mechanism that works after the stack has dealt with the actual properties. After all properties and paths are computed, they will be translated as late as possible before checked for inclusions: - When writing just before it is checked whether to add them to the properties parameter or not - When reading after they have been map-projected from the database into the result set but before they are checked for inclusions. Also addressed here is the a workaround for writes: In case a user had an interface based projection and used the graph property name as accessor, a write would succeed, however a read would fail. A property accessor has now been registered with the default projection factory that translates a failure to access an entity property (attribute) once. This fixes #2371.
I agree with option 1+2: Throwing in the renamed attributes at the moment when the dotPaths are created in 2 when we the entity is still available works. But it needed to be done in both reads and writes. I wanted to avoid another concept like the alternative naming function. We have too many call sites that are affect (6, actually, 3 for imperative and 3 for reactive). Also I took care of keeping the workaround in the SO question working (actually made it work for reads, too). |
Domain attributes can be renamed using the `@Property` annotation when being mapped to and read from graph properties. That renaming must also happening when using projections. As with #2451 in 582fd7d this is kind of a problem with the existing filter mechanism that works after the stack has dealt with the actual properties. After all properties and paths are computed, they will be translated as late as possible before checked for inclusions: - When writing just before it is checked whether to add them to the properties parameter or not - When reading after they have been map-projected from the database into the result set but before they are checked for inclusions. Also addressed here is the a workaround for writes: In case a user had an interface based projection and used the graph property name as accessor, a write would succeed, however a read would fail. A property accessor has now been registered with the default projection factory that translates a failure to access an entity property (attribute) once. This fixes #2371.
Domain attributes can be renamed using the `@Property` annotation when being mapped to and read from graph properties. That renaming must also happening when using projections. As with #2451 in 582fd7d this is kind of a problem with the existing filter mechanism that works after the stack has dealt with the actual properties. After all properties and paths are computed, they will be translated as late as possible before checked for inclusions: - When writing just before it is checked whether to add them to the properties parameter or not - When reading after they have been map-projected from the database into the result set but before they are checked for inclusions. Also addressed here is the a workaround for writes: In case a user had an interface based projection and used the graph property name as accessor, a write would succeed, however a read would fail. A property accessor has now been registered with the default projection factory that translates a failure to access an entity property (attribute) once. This fixes #2371. # Conflicts: # src/test/java/org/springframework/data/neo4j/integration/reactive/ReactiveProjectionIT.java
Inspired by https://stackoverflow.com/questions/68938823/sdn6-projection-interfaces-with-property-mapping
we should at least check if it is possible to create a connection between the defined method in a projection to the field in the domain object.
Reproducer / play along project: https://github.com/meistermeier/neo4j-issues-examples/tree/master/so-68938823
The text was updated successfully, but these errors were encountered: