1
votes

I have a simple test project where checking spring-data-neo4j with spring boot version: 2.1.0.RELEASE (https://github.com/tomkasp/neo4j-playground/blob/master/src/main/java/com/athleticspot/neo4jplayground/domain/AthleteRepository.java)

spring-data-neo4j (version: 5.1.4.RELEASE) dependency is injected by spring-boot-starter-data-neo4j.

My goal was to create a repository method which fetches data with containing and ingnorecase functionalities. In order to do that I've created below method within repository:

public interface AthleteRepository extends CrudRepository<Athlete, Long> {

    List<Athlete> findByNameContainingIgnoreCase(String name);

}  

When I run above functions I'm getting:

java.lang.IllegalStateException: Unable to ignore case of java.lang.String types, the property 'name' must reference a String
at org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.data.neo4j.repository.query.filter.PropertyComparisonBuilder.applyCaseInsensitivityIfShouldIgnoreCase(PropertyComparisonBuilder.java:101) ~[spring-data-neo4j-5.1.2.RELEASE.jar:5.1.2.RELEASE]

Doesn't spring-data-neo4j support Containing and IgnoreCase together? Am I missing something?

1
did you found a solution for this problem?dermoritz
It is already been added to the feature set (and solved) for the Moore release train jira.spring.io/browse/DATAGRAPH-1190meistermeier

1 Answers

0
votes

At the moment it seems not possible because the referenced org.springframework.data.neo4j.repository.query.filter.PropertyComparisonBuilder seems to allow ignoring case only for "SIMPLE_PROERTY" (is, or equals). See method canIgnoreCase in same class:

private boolean canIgnoreCase(Part part) {
    return part.getType() == SIMPLE_PROPERTY && String.class.equals(part.getProperty().getLeafType());
}

Fix is coming with spring 5.2 (Moore): https://jira.spring.io/browse/DATAGRAPH-1190