-
Notifications
You must be signed in to change notification settings - Fork 0
Support derived query methods from method names #12
Copy link
Copy link
Open
Description
Problem
The library currently has limited or no support for Spring Data-style derived query methods. Users must write explicit Cypher queries using @Query annotations for even simple lookups, which reduces developer productivity and increases boilerplate.
Current Workaround
public interface PersonRepository extends NodeRepository<Person, String, Void, Person> {
// Required: Explicit @Query for everything
@Query("MATCH (n:Person) WHERE n.age > $age RETURN n")
List<Person> findByAgeGreaterThan(@Param("age") int age);
@Query("MATCH (n:Person {name: $name}) RETURN n")
Optional<Person> findByName(@Param("name") String name);
@Query("MATCH (n:Person) WHERE n.age >= $min AND n.age <= $max RETURN n")
List<Person> findByAgeBetween(@Param("min") int min, @Param("max") int max);
@Query("MATCH (n:Person) WHERE n.active = true RETURN n ORDER BY n.name")
List<Person> findByActiveTrueOrderByByName();
}Expected Behavior (Spring Data Style)
public interface PersonRepository extends NodeRepository<Person, String, Void, Person> {
// Automatic query derivation
List<Person> findByAgeGreaterThan(int age);
Optional<Person> findByName(String name);
List<Person> findByAgeBetween(int min, int max);
List<Person> findByActiveTrueOrderByByName();
List<Person> findByAgeIn(List<Integer> ages);
List<Person> findByNameContaining(String substring);
List<Person> findByNameIgnoreCase(String name);
boolean existsByAge(Integer age);
long countByActiveTrue();
void deleteByAgeLessThan(int age);
}Proposed Solution
Implement a query derivation mechanism that parses method names and generates Cypher queries automatically.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels