I’m still struggling with policy mapping with Spring-Neo4j-Data:
This works:
neo4jTemplate.createEntityFromStoredType(node,
neo4jTemplate.getMappingPolicy(MyClass))
Whereas this doesn’t work:
neo4jTemplate.createEntityFromStoredType(node, null)
Why would that be?
My spring wiring is:
graphDatabaseFactory(GraphDatabaseFactory)
graphDatabaseService(GraphDatabaseService, “data/graph.db") { bean ->
bean.factoryBean = "graphDatabaseFactory"
bean.factoryMethod = "newEmbeddedDatabase"
bean.destroyMethod = "shutdown"
}
bootstrapper(WrappingNeoServerBootstrapper, graphDatabaseService) { bean ->
bean.initMethod = "start"
bean.destroyMethod = "stop"
}
xmlns neo4j:"
http://www.springframework.org/schema/data/neo4j"
neo4j.'repositories'( 'graphDatabaseService': "graphDatabaseService", 'base-package': "com.mycompany" )
neo4j.'config'( 'graphDatabaseService': "graphDatabaseService", 'base-package': "com.mycompany" )
ee(ExecutionEngine, graphDatabaseService)
neo4jTemplate(Neo4jTemplate, graphDatabaseService)
It’s doing my head in! I don’t want to have to read each node label by hand and then look for the right policy mapper for the associated class. :(.
I’ll buy a beer for anyone that can help me work this out!
Many thanks,
Joe