Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Spring-Data-Neo4j throws StackOverflowError when using a projection that recursively refers to itself

Notifications You must be signed in to change notification settings

cberes/sdn-recursive-projection-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdn-recursive-projection-bug

SDN is unable to save nodes using a projection that recursively references itself.

For example, say you have a node entity that recursively references itself

@Getter
@Node
public class Person {
  private String name;

  private List<Person> children = new LinkedList<>();
}

And a corresponding projection that references itself as well

public interface PersonWithChildrenRecursive {
  String getName();

  List<PersonWithChildrenRecursive> getChildren();
}

You cannot save a node using this projection

Person alice = new Person();
alice.setName("Alice");
neo4jTemplate.saveAs(alice, PersonWithChildrenRecursive.class); // throws StackOverflowError

Note that other ways to save will succeed, such as CrudRepository.save or Neo4jTemplate.saveAs with a projection that is not recursive.

I don't know if this a new bug or a regression. I noticed it first while using 6.3.3-SNAPSHOT but the bug is present in 6.3.2 as well.

Requirements

Don't forget to set database credentials in application.properties.

Tests

Run tests via mvn clean install or via an IDE.

About

Spring-Data-Neo4j throws StackOverflowError when using a projection that recursively refers to itself

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages