From 3bf64c80f5605f1ed4c1aa27ef81db9106075b4a Mon Sep 17 00:00:00 2001 From: Michael Hunger Date: Tue, 8 May 2012 13:01:05 +0200 Subject: [PATCH] DATAGRAPH-232 Initially create the indexes used for the type-representation-strategy (__types__ and __rel_types__) so that generated cypher queries don't complain about missing indices on an empty database --- .../AbstractIndexingTypeRepresentationStrategy.java | 1 + .../data/neo4j/repository/NoIndexDerivedFinderTest.java | 7 +++++++ .../data/neo4j/repository/PersonRepository.java | 3 +++ 3 files changed, 11 insertions(+) diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/typerepresentation/AbstractIndexingTypeRepresentationStrategy.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/typerepresentation/AbstractIndexingTypeRepresentationStrategy.java index fa999a12a..b0ebb2b16 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/typerepresentation/AbstractIndexingTypeRepresentationStrategy.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/typerepresentation/AbstractIndexingTypeRepresentationStrategy.java @@ -44,6 +44,7 @@ public abstract class AbstractIndexingTypeRepresentationStrategy result = personRepository.findByHeight( (short) 100 ); + assertEquals(0,IteratorUtil.count( result )); + } + @Test @Transactional public void findByName() { Iterable result = personRepository.findByName(""); diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java index 9aa4631f6..c47eacdd7 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java @@ -23,6 +23,7 @@ import org.springframework.data.neo4j.annotation.MapResult; import org.springframework.data.neo4j.annotation.Query; import org.springframework.data.neo4j.annotation.QueryType; import org.springframework.data.neo4j.annotation.ResultColumn; +import org.springframework.data.neo4j.conversion.EndResult; import org.springframework.data.neo4j.model.Group; import org.springframework.data.neo4j.model.Person; import org.springframework.data.repository.query.Param; @@ -84,6 +85,8 @@ public interface PersonRepository extends GraphRepository, NamedIndexRep @Query("start person=node:`name-index`('name:*') return person.name as name, person order by name asc ") Iterable getAllNamesAndPeople(); + EndResult findByHeight( short height ); + @MapResult interface NameAndPersonResult {