Skip to content

When saving using a projection, fields with similar names will also get persisted when using Neo4jTemplate::saveAs #2578

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

Closed
ejflick opened this issue Aug 3, 2022 · 1 comment
Assignees
Labels
type: bug A general bug

Comments

@ejflick
Copy link

ejflick commented Aug 3, 2022

Example project with a test that demonstrates the issue(PersonNeo4jTest):
https://github.com/ejflick/sdn-projection-similar-name-issue

If I have two fields in a node with a similar name where the camel, and I use a projection when saving that refers one of them, the other will also get persisted. Take for example an entity class that looks like this:

public class Person {

  // ... class truncated for brevity ...

  @Property
  private boolean friendsAlsoEatDoritos;

  @Relationship
  private Set<Person> friends = new HashSet<>();

  // ... class truncated for brevity ...
}

If I try to save an object of this class using this projection:

public interface PropertiesProjection {

  boolean getEatsDoritos();

  // If you comment this out, tests will pass and the relationships won't get persisted:
  boolean getFriendsAlsoEatDoritos();

}

The objects in the friends set will also get persisted despite not being a part of the projection. Comment out the following line and the projection works as expected:
boolean getFriendsAlsoEatDoritos(); (line 45 in the example's Person.java)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 3, 2022
@michael-simons michael-simons self-assigned this Aug 3, 2022
@michael-simons michael-simons added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 3, 2022
@michael-simons
Copy link
Collaborator

Thanks @ejflick Eric for reporting this. I can confirm this as a bug.

michael-simons added a commit that referenced this issue Aug 3, 2022
Fixes #2578 in which the mere presence of a fragment triggered inclusion of an otherwise excluded property.
michael-simons added a commit that referenced this issue Aug 3, 2022
Fixes #2578 in which the mere presence of a fragment triggered inclusion of an otherwise excluded property.
@michael-simons michael-simons added this to the 6.2.7 (2021.1.7) milestone Aug 3, 2022
@michael-simons michael-simons mentioned this issue Jan 4, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants