Java 如何正确创建JPQL请求?

Java 如何正确创建JPQL请求?,java,jpa,spring-data-jpa,jpql,Java,Jpa,Spring Data Jpa,Jpql,我有一个存储库方法: @Query(value = "select t from Transaction t " + "where t.bankAccountId in (:bankAccountIds) " + "and t.tradeTime is not null " + "and t.ccy is not null " + "and t

我有一个存储库方法:

@Query(value = "select t from Transaction t " +
        "where t.bankAccountId in (:bankAccountIds) " +
        "and t.tradeTime is not null " +
        "and t.ccy is not null " +
        "and t.net is not null " +
        "and t.tradeTime >= :startDate and t.tradeTime <= :endDate " +
        "and t.status = :status")
List<Transaction> findAllByBankAccountIdInAndTradeTimeBetween(@Param("bankAccountIds") Iterable<UUID> bankAccountIds,
                                                              @Param("status") TransactionStatus status,
                                                              @Param("startDate") LocalDateTime startDate,
                                                              @Param("endDate") LocalDateTime endDate);
@Query(value=“从事务t中选择t”+
“其中t.bankAccountId位于(:bankAccountId)”+
“并且t.tradeTime不为空”+
“且t.ccy不为空”+
“并且t.net不为空”+

“和t.tradeTime>=:startDate和t.tradeTime我想你不需要括号(:bankAccountIds)

我有另一种方法,其中有括号,它可以工作。它是接收单个值还是列表?接收列表你试过使用列表而不是iteable吗?这回答了你的问题吗?不,这不是我的问题=(您需要传入一个
列表
,并使用正确的语法是
in:bankAccountIds
。您可能需要一个空的参数列表,以便在()…
中添加异常的完整堆栈跟踪。