Ok, now I feel foolish. It turns out that you don't need repositories, and 
just defining an @Index _will_ cause the index to be constructed at start 
time... so long as the domain class is in the base-package pointed to by 
the neo4j config:

    neo4j.'config'( 'graphDatabaseService': "graphDatabaseService", 
'base-package': "db.domain" )

Whoops!

Sorry for wasting anyone's time.

Cheers,
Joe

On Monday, March 16, 2015 at 8:56:05 PM UTC, Josef Karthauser wrote:
>
> Hey folks,
>
> Does anyone know of a simple way of getting Spring Data Neo4j to create 
> indexes for a class without instantiating a repository?
>
> I'm using Neo4jTemplate to interact with the database, with a class like 
> this:
>
>     @NodeEntity
>     class ABaseBLPU {
>         @GraphId Long i
>         @Indexed(unique = true) long uprn
>         long uprn
>     }
>
> but the index isn't being created. I imagine that that would happen if I 
> was using a repository class:
>
>     interface MyGraph extends GraphRepository<ABaseBLPU> {}
>
> However, I've got loads of classes, and I don't really want to instantiate 
> graph repos for them all, as I'm not going to use the repo.
>
> So, do the indexes get created if I were to do:
>
>      def graph = neo4jTemplate.repositoryFor(ABaseBLPU.class)
>
> Or, is there a way to wire up the spring configuration so that the indexes 
> for the domain classes get created at startup time, but without having to 
> define all the repos?
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to