2015-11-07 39 views
0

我試圖用以下結構實現部分資源庫:部分實現倉庫和Spring數據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存儲庫?如果是這樣,我做錯了什麼?

+0

您的類示例是否具有屬性UserId?最後一行如何編譯? – jny

+0

不,Eaxmple類不具有userId,但它與用戶(具有)有關係。哪一條最後一行? – endrec

+0

'公共接口ExampleRepository擴展GraphRepository ,ExampleCustomRepository { }' – jny

回答

0

我忽略了命名約定,這個約定被解釋爲here

我也把ExampleCustomRepositoryImpl重命名爲ExampleRepositoryImpl