简体   繁体   English

jpa使用带有id和id的2@param删除错误

[英]jpa delete error using 2 @param with id and id

this is my code picture of code这是我的代码代码图片

im dont understand, i think i already made similar in 'comment' and 'cart' my problem in 'comment'我不明白,我想我已经在“评论”和“购物车”中提出了类似的问题,我在“评论”中的问题

this is example my cart entity with attribute order_identifier and product_id and this is success to delete by this two attribute这是我的购物车实体的示例,具有属性 order_identifier 和 product_id,这是通过这两个属性删除的成功

but after when im made similar in comment this error show up is this error because using two @param with 2 attribute id?但是当我在评论中做出类似的评论后,这个错误出现是因为使用了两个带有 2 个属性 id 的 @param 吗? im not find the answer anywhere yet, whoever you help me to fix my concept im really appreciate it :')我还没有在任何地方找到答案,无论你帮助我解决我的概念,我真的很感激 :')

Caused by: java.lang.IllegalStateException: Using named parameters for method public abstract void com.demo.lookopediaSinarmas.repositories.CommentRepository.deleteCommentByUserIdAndProductId(java.lang.Long,java.lang.Long) but parameter 'Optional[product_id]' not found in annotated query 'delete from comment where product_id:=product_id and user_id=:user_id'!引起:java.lang.IllegalStateException:将命名参数用于方法public abstract void com.demo.lookopediaSinarmas.repositories.CommentRepository.deleteCommentByUserIdAndProductId(java.lang.Long,java.lang.Long) 但参数'Optional[product_id]'不是在带注释的查询'delete from comment where product_id:=product_id and user_id=:user_id'中找到!

line 20使用: after =将解决您的问题。

有效的查询是

delete from comment where product_id=:product_id and user_id=:user_id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM