Caused by: java.lang.IllegalArgumentException: CONTAINING (1): [IsContaining, Containing, Contains]is not supported for redis query derivation - Redis

南笙酒味 提交于 2019-12-01 14:04:57

Ok lets start from "How Redis Work"

Redis work on Hashes for ID which helps in faster location of record. @Indexed is also hashed and stored for faster pin-pointing the record

So By Default for MiddleName the "contain" query will not work as Hash for "Test" string will not be contained in Hash for String "TestUser".

But ExampleMatcher is here to the rescue.

Source: https://docs.spring.io/spring-data/redis/docs/2.1.2.RELEASE/reference/html/#query-by-example

Solution for RoleName search on Role Object is relatively simple: Use this query

userRepository.findByRoleRoleName("ADMIN") (Basically remove the underscore)

And good news is that it can be combined with the above ExampleMatcher.

Let's discuss if you have doubt.

Helpfull Reference for RoleName search : Query Nested Objects in Redis using Spring Data

On Redis with Spring Boot you just have some queries for finder that are supported like Is, Equals, combine with And, Or , you can take a look on Table 9:

https://docs.spring.io/spring-data/redis/docs/current/reference/html/#redis.repositories.queries

UPDATED

You can create a query following this documentation link as reference

https://docs.spring.io/spring-data/redis/docs/2.1.2.RELEASE/reference/html/#query-by-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!