0

I'm trying to partially implement a repository using the following structure:

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 {
}

For some reason the RepositoryFactory wants to create a DerivedGraphRepositoryQuery for this implemented method, and fails:

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

Is it even possible to partially implement a repository with SDN4? If it is, what am I doing wrong?

endrec
  • 447
  • 6
  • 17
  • Does your class Example has property UserId? And how does the last line even compile? – jny Nov 07 '15 at 23:24
  • No, the Eaxmple class does not have userId, but it has a relationship to a user (which has). Which last line? – endrec Nov 08 '15 at 11:18
  • `public interface ExampleRepository extends GraphRepository, ExampleCustomRepository { }` – jny Nov 09 '15 at 13:57
  • Did you take a look at this question? http://stackoverflow.com/questions/11880924/how-to-add-custom-method-to-spring-data-jpa – jny Nov 09 '15 at 14:01
  • @jny that question did not came up when I searched for an answer, and it actually helped. I overlooked the naming convention. If you add an answer based on that, I'll accept it. – endrec Nov 13 '15 at 20:15

1 Answers1

0

I overlooked the naming convention, which was explained here.

I had too rename ExampleCustomRepositoryImpl to ExampleRepositoryImpl.

Community
  • 1
  • 1
endrec
  • 447
  • 6
  • 17