【发布时间】:2021-10-21 16:26:13
【问题描述】:
我正在尝试了解 Spring Web Flux。我能够得到@getmapping 来把我的json 参数还给我。在 cassandra 数据库中,我能够使用存储库中的该命令删除一行,但我无法从命令行中删除一行。大家有什么推荐的?
//This code is in my controller
//It's supposed to call method when I type in my terminal "curl localhost:8080/orders/delete/1"
@DeleteMapping("/delete/{id}")
public Mono<Integer> deleteOrder(@PathVariable("id") int id){
//This code is in my service called after the top portion
public Mono<Integer> deleteOrder(int id) {return orderRepository.deleteOrder(id);} {
//And then in my repository this should be the last called method
public Mono<Integer> deleteOrder(int uuid) {
// log.info("Attempting to delete");
Flux.from(
session.executeReactive(
SimpleStatement.builder("DELETE FROM LightNfresh.orders WHERE order_id = ?")
.addPositionalValue(uuid)
.build()))
.subscribe();
return Mono.just(uuid);
}
【问题讨论】:
标签: java spring cassandra reactive webflux