Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Data Neo4j - '__type__' property not found for NodeImpl#0

I am trying to play with neo4j with the help of spring data in my java application. Currently i'm facing a strange problem. Following is the scenario.

I have:
1. Two UserNode, say A and B, where "UserNode" is java @NodeEntity class. 
2. A @RelationshipEntity "RequestedTo" which is again a java class. 
3. A relationship "A RequestedTo B" which is directed towards B.

Now when i try to fetch all the UserNode which have a RequestedTo relationship directed towards B i get following exception

Caused by: org.neo4j.graphdb.NotFoundException: '__type__' property not found for NodeImpl#0.
    at org.neo4j.kernel.impl.core.Primitive.newPropertyNotFoundException(Primitive.java:184)
    at org.neo4j.kernel.impl.core.Primitive.getProperty(Primitive.java:179)
    at org.neo4j.kernel.impl.core.NodeImpl.getProperty(NodeImpl.java:52)
    at org.neo4j.kernel.impl.core.NodeProxy.getProperty(NodeProxy.java:155)
    at org.springframework.data.neo4j.support.typerepresentation.AbstractIndexingTypeRepresentationStrategy.readAliasFrom(AbstractIndexingTypeRepresentationStrategy.java:106)

Here i do following query to neo4j using GraphRepository interface provided in Spring.

START user=node:searchByMemberID(memberID={0}) , member=node(*), root = node(0) MATCH user<-[r:RequestedTo]-member WHERE member <> root RETURN member

Also, when i fire this query in neoclipse i can see that there is no "type" property on UserNode in result. But when i try this query in neo4j browser console i can see the "type" property coming in the result set.

like image 794
Prabhat Avatar asked Sep 01 '26 05:09

Prabhat


2 Answers

I just played a little bit with Neo4j but try this instead:

START user=node:searchByMemberID(memberID={0}) , member=node(*)
MATCH user<-[r:RequestedTo]-member 
WHERE id(member) <> 0 
RETURN member
like image 104
jarandaf Avatar answered Sep 04 '26 14:09

jarandaf


You don't need to specify member in start, cypher takes care of that itself. After all local queries from a single or few starting points is what graph databases is about:

START user=node:searchByMemberID(memberID={0})
MATCH user<-[r:RequestedTo]-member 
RETURN member
like image 36
Michael Hunger Avatar answered Sep 04 '26 16:09

Michael Hunger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!