2

I'm trying to use spring data neo4j in my project here's a simple entity:

@NodeEntity
public class Actor{

@GraphId
private Long id;

@Property(name="name")
private String fullName;

@Relationship(type="ACTED_IN", direction=Relationship.OUTGOING)
private List<Movie> filmography = new ArrayList<Movie>();
}

I wonder if there is a way to tell spring to use lazy load on entity relationships?

Luanne
  • 19,145
  • 1
  • 39
  • 51
Yuriy Dubyna
  • 82
  • 1
  • 6
  • [Implementing Lazy Loading in Spring Data Neo4j](http://stackoverflow.com/questions/8852491/lazy-eager-loading-fetching-in-neo4j-spring-data) and [Lazy/Eager loading/fetching in Neo4j/Spring-Data](http://stackoverflow.com/questions/15564880/implementing-lazy-loading-in-spring-data-neo4j) may help you – Sasha May 23 '16 at 14:41

1 Answers1

7

There isn't a concept of lazy loading in SDN 4. To avoid loading all related entities, you can load the entity to depth 0- this will load only properties of the entity but no relationships.

Loading the entity to depth 1 (the default), will load properties of the node, related nodes and their properties.

Note however that at this time, you cannot load certain relationships and exclude others. There's a feature request open for this, feel free to +1

Luanne
  • 19,145
  • 1
  • 39
  • 51