java - 需要为Query编写Spring Data JPA接口方法
问题描述
如何将以下本机转换为 Spring Data JPA 接口方法:
@Query(nativeQuery = true,
value = " select count(*) from TABLE "
+ "where ( ColumOne =:xyz or ColumnTwo =:xyz ) "
+ "and STATUS_TX in ('On Hold')")
int countAllByStatusAndName(@Param("xyz") String xyx);
我写成
Long countByStatusTXAndColumnOnOrColumnTwo (String status, String xyz)
. 但它不工作
我特别需要 ColumnOne 和 ColumnTwo 之间的那个或条件。
解决方案
方法名称似乎有错字。ColumnOn
而不是ColumnOne
. 尝试Long countByStatusTXAndColumnOneOrColumnTwo (String status, String xyz)
推荐阅读
- javascript - 使 div 可选
- javascript - 从 CDN 提供 javascript 库与将它们组合为一个并用作单个 http 连接
- java - 无法解决对构造函数的动态引用
- c# - C# 使用反射列出 FindAll
- php - 通过 API 向 Greenhouse 提交申请
- linux - 如何使用来自数据来源的数据打印文件名?
- sip - 我有一个带有 SIP/RTP 的 PCAP 文件...我可以将它重放到交换机中以测试兼容性吗?
- javascript - 如果我们不能从父组件更改属性或操作它们,@ViewChild 有什么用?
- azure - SharePoint 框架 (SPFx) 访问使用 AzureAD 保护的自定义 API
- netlogo - 计算代理集中的品种