java - 使用 IN 对象列表将 Oracle SQL 查询转换为 Spring JPA
问题描述
我无法将以下工作 SQL 查询转换为 JPA:
SELECT a.* FROM TableA a1, TableB b1, TableC c1 WHERE
a1.c = c1.c AND a1.b = b1.b AND
(a1.attr1, b1.anotherAttrB, c1.anotherAttrC) IN (('2016','2004','678'), ('2020','2004','678'));
这是我尝试过的 JPA 查询,但失败了:
@Query(value = "SELECT a FROM TableA a1, TableB b1, TableC c1 WHERE
a1.c = c1.c AND a1.b = b1.b AND
(a1.anotherAttrA, b1.anotherAttrB, c1.anotherAttrC) IN :myObjectList")
public List<A> findByMyObjectListIn(@Param("myObjectList") List<MyObject>myObjectList);
其中 MyObject 只是一个带有三个字符串的简单 POJO。
有什么想法吗?
解决方案
推荐阅读
- java - 预启动报告 UiAutomation 未连接错误
- php - SQL Query如何调用枚举?
- spring - 具有自动缩放订阅者的 Spring Cloud Stream 是否会使用云 pubsub binder 处理相同的消息?
- angular - 有没有办法与 nativescript angular 中的文本选择菜单进行交互?
- mysql - 使用 JOIN 表的错误 MySQL 查询结果
- matlab - Matlab:从谱密度到方差
- r - 在 R 中调整树/窗口的大小
- javascript - 根据深度值在对象树中搜索
- sql-server - 从 EAP 7.0 连接到 Microsoft SQL 时出现问题
- c# - 使用前 6 个(或任何)数量的字符检查目录是否存在