下面的代码使用Specification
来构建复杂的where子句。
public interface EmployeeRepository extends
CrudRepository<Employee, String>,
JpaSpecificationExecutor<Employee> {
}
public class Service {
@Autowired
private EmployeeRepository employeeRepository;
public List<Employee> test() {
return employeeRepository.findAll(where(hasNames(List.of("Tom", "Jerry"))).and(hasAges(List.of(20,21))));
}
}
字符串
我尝试使用r2dbc将此代码转换为响应式。我将CrudRepository
替换为ReactiveCrudRepository
。然而,为了构建复杂的where子句,我需要使用Specification
。我没有看到JpaSpecificationExecutor
的响应式版本
public interface EmployeeRepository extends
ReactiveCrudRepository<Employee, String>,
JpaSpecificationExecutor<Employee> { // is there ReactiveJpaSpecificationExecutor?
}
型
有没有JpaSpecificationExecutor的React式版本,或者有没有一种方法可以在React式中构建这样的where子句?
2条答案
按热度按时间ohtdti5x1#
我也在等待Criteria,但我现在没有看到;-)我需要实现beetwen:Spring JPA ExampleMatcher compare date condition
参见类似问题:https://github.com/spring-projects/spring-data-jpa/issues/1331https://github.com/r2dbc/r2dbc-spi/issues/141
也许你现在可以使用模板:https://hantsy.medium.com/update-accessing-rdbms-with-spring-data-r2dbc-a4d118b1669d或infobip-spring-data-queryweb
dkqlctbz2#
我使用ReactiveQuerydslPredicateExecutor
字符串