Reputation: 2134
I have a spring 3.1 (Milestone) and Spring Data Neo4J 2.1 RC project running set up. All starts up properly and the neo4j database is being populated as desired, also visible in neoclipse.
Now I fetch an entity (lets call it Container.java) by id and have the relation "Event".
The relation in Container.java is modelled as follows:
@RelatedTo(type="HAS_EVENTS", direction = Direction.BOTH)
Set<Event> events = new HashSet<Event>();
When I access container.getEvents() and iterate over them, I can see that the single event has an id, but all other properties are null :( When having a look with neoclipse, all properties are saved as they should be.
Is there some kind of "eager" or "lazy" loading? I do not use a @RelationshipType.
Upvotes: 5
Views: 930
Reputation: 1
@Fetch entity is for eager loading
for lazy loading ,you can use neo4jTemplate.fetch
method template.fetch(Event.getEvents())
Upvotes: 0
Reputation: 2134
One night spent: I have to add the @Fetch entity. Makes sense from my point of view, as if there was eagerly loading enabled, I could easily generate cycles :)
Upvotes: 6