The point is that I don’t want to have to work out the class of the entity in 
advance, by looking at labels and so on.  The method 
neo4jTemplate.createEntityFromStoredType(node, null) is supposed to do that, 
but it doesn’t work for me unless I’ve previously tickled it by using:

        myDomainClasses.each {
            neo4jTemplate.getMappingPolicy(it)
        }

:(

I haven’t managed to work out how to get the SDN source bound to my project, so 
I’ve not been able to step into the code to work out what’s going wrong.

Joe


> On 4 Apr 2015, at 01:08, Michael Hunger <[email protected]> 
> wrote:
> 
> In the end getMappingPolicy just calls mappingContext.getPersistentEntity() 
> which should fail if the entity is not known.
> 
> you actually should never call that method directly.
> 
> can you use template.project(entity, type) instead?
> 
> Michael
> 
>> Am 30.03.2015 um 22:37 schrieb Dr Josef Karthauser 
>> <[email protected] <mailto:[email protected]>>:
>> 
>> Neo4j config, or spring config? I’ve not set anything different from what 
>> comes out of the box.
>> 
>> I’m confused, because with the wiring:
>> 
>>>> >            neo4j.'repositories'( 'graphDatabaseService': 
>>>> > "graphDatabaseService", 'base-package': "com.mycompany" ) 
>>>> >            neo4j.'config'( 'graphDatabaseService': 
>>>> > "graphDatabaseService", 'base-package': "com.mycompany" ) 
>> 
>> the repositories are scanned and wired, and work ok. Why would they work, 
>> but the explicit getEntityFromStored type not?
>> 
>> Joe
>> 
>> 
>>> On 28 Mar 2015, at 18:51, Michael Hunger <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> What does your config look like? Do you provide your base package(s) of 
>>> your entities?
>>> 
>>> It looks a bit as if SDN doesn't know your entities yet?
>>> 
>>> Michael
>>> 
>>>> Am 28.03.2015 um 17:09 schrieb Josef Karthauser <[email protected] 
>>>> <mailto:[email protected]>>:
>>>> 
>>>> No, that's the surprising thing. Supplying a null only works for classes 
>>>> for which I've already run 'neo4jTemplate.getMappingPolicy(ClassName)' on.
>>>> 
>>>> Joe  
>>>> 
>>>> On Friday, March 27, 2015 at 11:18:13 PM UTC, Michael Hunger wrote:
>>>> You usually don't have to bother with this. 
>>>> 
>>>> how does this ` neo4jTemplate.createEntityFromStoredType(node, null)` not 
>>>> work? 
>>>> 
>>>> M 
>>>> 
>>>> > Am 23.03.2015 um 18:04 schrieb Dr Josef Karthauser <joe.kar...@ 
>>>> > <>wansdyketele. <http://wansdyketele.com/>com 
>>>> > <http://wansdyketele.com/>>: 
>>>> > 
>>>> > 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 
>>>> > <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 
>>>> > 
>>>> > -- 
>>>> > 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 neo4j+un...@ <>googlegroups.com <http://googlegroups.com/>. 
>>>> > For more options, visit https://groups.google.com/d/optout 
>>>> > <https://groups.google.com/d/optout>. 
>>>> 
>>>> 
>>>> -- 
>>>> 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] 
>>>> <mailto:[email protected]>.
>>>> For more options, visit https://groups.google.com/d/optout 
>>>> <https://groups.google.com/d/optout>.
>>> 
>>> 
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Neo4j" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/neo4j/0suc8GmgTpM/unsubscribe 
>>> <https://groups.google.com/d/topic/neo4j/0suc8GmgTpM/unsubscribe>.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected] 
>>> <mailto:[email protected]>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>> 
>> 
>> -- 
>> 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] 
>> <mailto:[email protected]>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Neo4j" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/neo4j/0suc8GmgTpM/unsubscribe 
> <https://groups.google.com/d/topic/neo4j/0suc8GmgTpM/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/d/optout.

Reply via email to