Spring CrudRepository extensions call wrong views, Auto Naming Bug?


i am currently trying to convert a project to Spring/Couchbase and am having difficulty with the CrudRepository<?,?> Interface. I followed these posts and get the same problem as in my simplified test-case:

The auto-generated “findAll()” Method converts my ClassName vom “TestData” to “testdata” as the DesignDocument (lowercase)
The additionally added “findByDate” Method converts my ClassName vom “TestData” to “testData” as the DesignDocument (lowerCamelCase)

Thus the only way to not get an error is to define two DesignDocuments
_design/testdata -> “all” View
_desgin/testData -> “byDate” View

Tested with:
Version: 4.0.0-4051 Community Edition (build-4051)
1.2.1.RELEASE (copy of the repo mentioned in the blog post)

I am probably missing something here?
This seems to be a rather easy to spot bug and should have haunted several people

    CommandLineRunner commandLineRunner(TestDataRepository repo, TestService service) {
        return args -> {
            TestData tu = new TestData("key", 0, 0);
            Iterable<TestData> findAll = repo.findAll();

            Query query = new Query();
            query.setRange("0", "999");
            Collection<TestData> updates = repo.findByDate(query);

I believe this has been fixed in the 2.0.x branch (version 2.0, which is still in Release Candidate state but should be GA release very soon). It is a complete rewrite that comes with a lot of new features, so you may want to watch out for the release :smile:

Maybe this can be easily fixed in the 1.4.x release train if the Spring Data dev leads plan to do a bugfix release at some point. Would you be considering offering a pull-request on master?

Hey, thank you for the fast reply.

I did not test 2.0.x by now as the API changed heavily but it seems the bug is solved there.
The findAll() call now uses lowerCamelCase as does the updated ViewQuery


Regarding the pull request:
As I only just started actively looking into spring two days ago I am going to use the 2.0.0 RC1 and not try to fix a software I just started to learn. :sweat: