Skip to content

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

Closed
@ejflick

Description

@ejflick

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)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions