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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With