Hi All, I am just trying lash together a simple data import using Spring 
Data and Neo4j. I am just trying to import wine ratings data, so I will 
have a 'Wine' and a 'User' and the relationship between them will be a 
rating which has a propery which the rating the User gave the wine.

I am creating a single set of objects using some hardcoded data, upon 
saving the data I get the following error

>From what I can see its trying to get one of the nodes I have created (but 
not yet saved) by its id which is 1.


 Caused by: org.neo4j.graphdb.NotFoundException: 1
    at 
org.neo4j.rest.graphdb.ExecutingRestAPI.getNodeById(ExecutingRestAPI.java:91)
    at org.neo4j.rest.graphdb.RestAPIFacade.getNodeById(RestAPIFacade.java:57)
    at 
org.neo4j.rest.graphdb.RestGraphDatabase.getNodeById(RestGraphDatabase.java:64)
    at 
org.springframework.data.neo4j.support.mapping.EntityStateHandler.getPersistentState(EntityStateHandler.java:107)
    at 
org.springframework.data.neo4j.support.mapping.EntityStateHandler.getPersistentState(EntityStateHandler.java:93)
    at 
org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.getPersistentState(Neo4jEntityPersister.java:221)
    at 
org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.persist(Neo4jEntityPersister.java:242)
    at 
org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.persist(Neo4jEntityPersister.java:231)
    at 
org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:294)
    at 
org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:288)
    at 
org.springframework.data.neo4j.repository.AbstractGraphRepository.save(AbstractGraphRepository.java:110)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at 
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:344)
    at 
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:329)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at 
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at 
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
    ... 24 more





.



Digging further into whats happening I can see the following code in 
org.springframework.data.neo4j.support.mapping.Neo 
4jEntityPersister.persist(...):

                                                        

           

if (isNodeEntity(type)) {   
            final Node node = this.<Node>getPersistentState(entity); // <- line 
242 in Neo4jEntityPersister.java
            this.nodeConverter.write(entity, node,mappingPolicy, template, null 
);
            return createEntityFromState(getPersistentState(entity),type, 
getMappingPolicy(type), template);
            //return entity; // TODO ?
        }




      If gets the node before writing it? The underlying code in Neo4j then 
throws an exception because it cannot be found.

What am I doing wrong?

For info I am using the following dependencies through Gradle:
 Code:

org.springframework.data:spring-data-neo4j:2.3.2.RELEASE
org.springframework:spring-context:4.0.0.RELEASE
javax.validation:validation-api:1.0.0.GA
org.springframework.data:spring-data-neo4j-rest:2.3.2.RELEASE

Happy to post up the rest of my code if required.

Thanks for any help 


-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to