As the title, Spring Data Neo4j
doesn't execute the right derived queries. Let me clarify the concept with an example. I have the following class
@RelationshipEntity
public class MashupToMashupSimilarity {
private float score;
//GETTER AND SETTER
}
and to access the objects of the class I use a simple repository class
public interface MashupToMashupSimilarityRepository extends
GraphRepository<MashupToMashupSimilarity> {
public Set<MashupToMashupSimilarity> findByScoreGreaterThan(float score);
}
When I execute the method above, the logger shows the following query
DEBUG [CypherQueryEngine] - Executing cypher query: START `mashupToMashupSimilarity`=node:__types__(className="package.MashupToMashupSimilarity") WHERE `mashupToMashupSimilarity`.`score`! > {0} RETURN `mashupToMashupSimilarity` params {0=0.1}
Note that it use node:__types__
as index, while instead it should use rel:__rel_types__
; so, it always return an empty result set. OTH, if I execute the query replacing the wrong index with the right one, the it returns right results.
The strange thing is that invoking MashupToMashupSimilarityRepository#findAll()
(or #count()
or other inherited methods inherited from the above repositories) the result sets are non empty. However, I don't know which kind of query got executed because ATM I haven't found a way to log the queries.
Is this a bug or I am missing something? I use the following versions and I'm unable to upgrade them
<spring.version>3.1.2.RELEASE</spring.version>
<spring-data-neo4j.version>2.1.0.RELEASE</spring-data-neo4j.version>
<neo4j.version>1.9.M02</neo4j.version>