Problem with custom save(T) implementation -Spring Data Commons version 1.3.1.RELEASE
Few months ago I worked in a project using Spring Data (Commons 1.2.1.RELEASE + JPA 1.0.3.RELEASE) and everything went fine.
Last week I started a new project with the same code (refactoring old code) and moved on to the the latest version of both (Commons 1.3.1.RELEASE + JPA 1.1.0.RELEASE) and some of my unit tests started to fail.
I changed my custom implementation to match the new signature but nothing changes. So I cloned the git repository, changed back and rebuild it to make sure that this was the problem and confirmed it.
I didn't know if I should post it here, create a JIRA for it or what so here I am.
I wanted to confirm if anyone else is having this problem and if there's any workaround or if I should create a JIRA for it.
If the signature of your custom implementation matches the one in CrudRepository you should get the method invoked. If that's not the case definitely go ahead and open a ticket, possibly with a test case to reproduce the issue.
You might wanna have a look at RepositoryFactorySupportUnitTests and invokesCustomMethodIfItRedeclaresACRUDOne() in particular as this test seems to test what you're shooting for. Maybe you can alter it to fit your scenario more closely and bring it to fail…
I created two examples, one is broken and one contains the workaround I'll be using. They are both attached and both the same project. As simple as I can think of to reproduce the problem. Just unzip and run mvn test.
I'm still not sure if this is a bug or a configuration problem from my side because I wasn't able to reproduce it using the mock objects in the unit test you mentioned.
Please let me know if you can figure out what is wrong or if I should open a JIRA bug.