使用Spring数据Neo4j 4部分实现的存储库

时间:2015-11-07 22:12:18

标签: java spring java-8 spring-data-neo4j-4

我尝试使用以下结构部分实现存储库:

public interface ExampleCustomRepository {
    Iterable<Example> findExamplesByUserId(Long id);
}

@Repository
@Transactional
public class ExampleCustomRepositoryImpl implements ExampleCustomRepository {
    @Autowired
    private Neo4jTemplate template;

    @Override
    public Iterable<Example> findExamplesByUserId(final Long id) {
        // implementation
    }
}

public interface ExampleRepository extends GraphRepository<Example>, ExampleCustomRepository {
}

出于某种原因,RepositoryFactory想要为此实施的方法创建DerivedGraphRepositoryQuery,并失败:

org.springframework.data.mapping.PropertyReferenceException: No property userId found for type Example!

是否可以使用SDN4部分实现存储库?如果是的话,我做错了什么?

1 个答案:

答案 0 :(得分:0)

我忽略了命名惯例,解释here

我将ExampleCustomRepositoryImpl重命名为ExampleRepositoryImpl