Reputation: 11
I am using redis as my data store and i am using spring boot starter data redis as the dependency and a crud repository for CRUD operation. When i do deleteById it is working. But when i do deleteByName (Name is not an id column) it is saying query method not supported. When the data source is redis and if we use spring boot starter data redis, it is possible only to deleteById column and not by other columns?
Upvotes: 1
Views: 1457
Reputation: 51
I had the same problem that after a lot of searching and also checking the following link: Redis 2.1.2.RELEASE doc reference I realized that since Redis is based on Key and Valve, the following solution should be used:
List<SampleClass> lst = cacheTokenRepository.findAllBySampleFields(... sampleFields);
lst.forEach(item->
SampleRepository.deleteById(item.getId())
);
In this solution we search the list of records that match our conditions and delete them all based on id
Upvotes: 3