我有具有此属性的Foo类
public class Foo {
private String fooPath;
}
而且我正在使用,FooRepository扩展了CrudRepository,QueryByExampleExecutor
但是spring数据不支持字符串匹配器REGEX
Redis按示例查询不支持字符串匹配器REGEX。支持的匹配器为:[DEFAULT,EXACT]。
如何检索以所需字符串开头的所有Foo对象?
也许像这样吗?
@Repository
FooRepository extends CrudRepository, QueryByExampleExecutor {
@Query("SELECT Foo f where f.fooPath REGEXP :myRegexp")
public Foo findLikePath(@Param("myRegexp") String myRegexp);
}