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

huangapple go评论76阅读模式
英文:

jpa delete error using 2 @param with id and id

问题

这是我的代码
代码图片

我不明白,我认为我已经在'comment'和'cart'中做了类似的东西。
我的问题在'comment'中。

这是我带有order_identifier和product_id属性的购物车实体示例,通过这两个属性成功删除,链接

但在我在评论中做类似操作后,出现了这个错误。
这个错误是否是因为在使用两个@Param和2个属性ID?
我还没有在任何地方找到答案,如果您能帮我修正我的概念,我会非常感谢您:')

导致原因:java.lang.IllegalStateException: 在方法public abstract void com.demo.lookopediaSinarmas.repositories.CommentRepository.deleteCommentByUserIdAndProductId(java.lang.Long,java.lang.Long)中使用命名参数,但在注释查询'delete from comment where product_id:=product_id and user_id=:user_id'中未找到参数'Optional[product_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

but after when im made similar in comment this error show up
is this error because using two @param with 2 attribute id?
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'!

答案1

得分: 1

在第20行,在等号后面使用冒号:,可以解决你的问题。

英文:

At line 20 by using : after = will resolve your problem.

答案2

得分: 0

有效查询是

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

Valid query is

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

huangapple
  • 本文由 发表于 2020年9月18日 19:27:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/63954888.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定