-1

Can not hydrate "owns" collection property (annotation property) in a simple POJO. the owns property comes back empty.

I'm using neo4j ogm 2.0.6, spring boot, and remote NEO4J Community server 3.1.1.

NEO4J cypher query to populate db :

CREATE (n:Entity { name: 'Bank of A', fid: '100' })

CREATE (n:Entity { name: 'Bank of B', fid: '200' })

MATCH (boa:Entity{fid:'100'}), (bob:Entity{fid:'200'}) 
                            CREATE (boa) -[:OWNS]->(bob);

In the controller :

Entity entity = session.load(Entity.class, neo4jId, 1);
return entity.getOwns(); 

Set of Entities should contain an instance of 'Bank of B' but returns empty set :

@NodeEntity
public class Entity {
    @GraphId Long id;
    private String name;

    @Relationship(type="OWNS")
    private Set<Entity> owns;

    public Entity() {
        this.owns = new HashSet<Entity>();
    }
}
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213

1 Answers1

0

Needed to pass -1 as the 3rd argument to make relationships load eagerly. Entity entity = session.load(Entity.class, neo4jId, -1);