当它是唯一的元素时,避免在注释中使用值

问题描述 投票:0回答:1

“UnnecessaryAnnotationValueElement:当它是唯一元素时,避免在注释中使用值”

@Query(value = "SELECT t FROM IntraPaymentTransaction t WHERE exchangeBuyAmount.currency <> exchangeSellAmount.currency")

我在我的存储库中使用此查询,但 PMD 返回“UnnecessaryAnnotationValueElement:当它是唯一元素时避免在注释中使用值” 你有什么想法吗?

java spring jpa pmd
1个回答
0
投票

当值是唯一元素时,不必指定它。

@Query(value = "SELECT t FROM IntraPaymentTransaction t WHERE exchangeBuyAmount.currency <> exchangeSellAmount.currency")

可以替换为:

@Query("SELECT t FROM IntraPaymentTransaction t WHERE exchangeBuyAmount.currency <> exchangeSellAmount.currency")
© www.soinside.com 2019 - 2024. All rights reserved.