External Query Files
Place .cypher files in src/main/resources/queries/:
MATCH (p:Person)WHERE p.isActive = trueRETURN properties(p)Load and use:
@Configurationclass QueryConfig @Autowired constructor( private val loader: QueryLoader) { @Bean fun findActiveUsers() = CypherStatement(loader.load("findActiveUsers"))}
@Componentclass PersonRepository @Autowired constructor( @Qualifier("neoManager") val manager: PersistenceManager, val findActiveUsers: CypherStatement) { fun getActive(): List<Person> { return manager.query( QuerySpecification .withStatement(findActiveUsers.statement) .transform(Person::class.java) ) }}
