2

Does Spring Data Key Value support derived delete query methods? It doesn't work for me.

I extended Repository, declared a few CrudRepository methods, and added these derived query methods to it:

List<ChatMessageEntity> findByChatIdOrderBySequenceNumberAsc(String chatId);
List<ChatMessageEntity> removeByChatId(String chatId);
Long deleteByChatId(String chatId);

All the unit tests pass except for the 2 derived delete query methods. removeByChatId returns the expected list, but does not delete anything. deleteByChatId throws this UnsupportedOperationException:

java.lang.UnsupportedOperationException: Query method not supported.
    at org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery.execute(KeyValuePartTreeQuery.java:97)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy29.deleteByChatId(Unknown Source)
    at com.pgi.kcondon.axonminexp.service.ChatRepositoryTest.testRemoveByChatId(ChatRepositoryTest.java:159)

I'm using Spring Boot 1.3.3.RELEASE, which depends on Spring Data Key Value 1.0.4.RELEASE.

Kevin Condon
  • 1,618
  • 10
  • 16
  • 1
    I've created [DATAKV-135](https://jira.spring.io/browse/DATAKV-135) to add support for this to the key-value module. – Christoph Strobl May 04 '16 at 05:45
  • Thanks @ChristophStrobl. Key Value has been very helpful for building out a new system without having to deal with, or commit to, a specific distributed repository platform. – Kevin Condon May 04 '16 at 13:53
  • Just wanted to add my support for DATAKV-135, it would be very useful to have. – Carlos Mar 25 '19 at 06:42

0 Answers0