Ok, I was wondering whether it was my live data that was the problem, but 
it appears not.

I can get the code working if I explicitly get the mapping policy by hand:

    Collection getLocatedObjectsOfType2(List<Class> domainClasses) {
        def labels = domainClasses.collect { "\"${it.simpleName}\"" }.join 
","
        def cypher = "MATCH (a:Location)<-[*0..]-(b) where ANY (x IN 
LABELS(b) WHERE x in [${labels}]) RETURN DISTINCT b"
        def result = ee.execute(cypher)

        result.columnAs('b').collect { def n ->
            def className = n.getLabels().find { DynamicLabel l -> 
l.name().startsWith("_") }.name().replace("_", "")
            def policy = 
neo4jTemplate.getMappingPolicy(Class.forName("db.domain.${className}"))

            // I shouldn't need to load the policy by hand - it ought to 
work if I just pass a 'null' in, no?
            // policy = null

            neo4jTemplate.createEntityFromStoredType(n as 
PropertyContainer, policy)
        }
    }


I really don't understand why the auto mapping policy works in some 
circumstances and not in others.

Joe


On Saturday, February 28, 2015 at 8:00:59 AM UTC, Josef Karthauser wrote:
>
> Scrub that. That just changed things but didn't fix it.
>
> I've managed to get grails to give a full stack trace and the original 
> exception is being thrown as follows:
>
> Message: [Assertion failed] - this argument is required; it must not be 
> null
>     Line | Method
> ->>  112 | notNull                         in 
> org.springframework.util.Assert
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> |    123 | notNull                         in     ''
> |    159 | getPersistentEntity . . . . . . in 
> org.springframework.data.mapping.context.AbstractMappingContext
> |     81 | read                            in 
> org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl
> |    170 | read . . . . . . . . . . . . .  in 
> org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister$CachedConverter
> |    189 | createEntityFromState           in 
> org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister
> |     57 | createEntityFromStoredType . .  in     ''
> |     -1 | call                            in 
> org.springframework.data.neo4j.mapping.EntityPersister$createEntityFromStoredType
>
> Joe
>
> On Saturday, February 28, 2015 at 7:33:06 AM UTC, Josef Karthauser wrote:
>>
>> That doesn't fix it, unfortunately. :(  (My entities are in db.domain)
>>
>> But, I have made some progress. I can get it to work if I explicitly 
>> create the entity from the persister:
>>
>>         result.columnAs('b').collect { def n ->
>>             
>> neo4jTemplate.infrastructure.getEntityPersister().createEntityFromStoredType(n,
>>  
>> neo4jTemplate)
>>         }
>>
>> That's bizarre.
>>
>> Joe
>>
>> On Saturday, February 28, 2015 at 12:40:35 AM UTC, Michael Hunger wrote:
>>>
>>> this should point to your domain package, something like this
>>>
>>>             neo4j.'config'( 'graphDatabaseService': 
>>> "graphDatabaseService", 'base-package': *"db.entities.neo4j"* )
>>>
>>> Am 27.02.2015 um 18:12 schrieb Dr Josef Karthauser <
>>> [email protected]>:
>>>
>>> On 27 Feb 2015, at 14:04, Dr Josef Karthauser <
>>> [email protected]> wrote:
>>>
>>>

-- 
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