gpt4 book ai didi

spring - JPA JPQL IN 子句 : How to use IN clause in JPA?

转载 作者:行者123 更新时间:2023-12-04 03:02:21 25 4
gpt4 key购买 nike

@Query("SELECT al FROM Customer al WHERE al.companyCode = ?1 AND al.fileCode IN ?2")

List findallByGroup(int CompanyCode, String groups);

或者

@Query("SELECT al FROM Customer al WHERE al.companyCode = :CompanyCode AND al.fileCode IN :groups")

List<Customer> findallByGroup(@Param("CompanyCode") int CompanyCode,@Param("groups") List<BigInteger> groups);

@Query("SELECT al FROM Customer al WHERE al.companyCode = :CompanyCode AND al.fileCode IN (:groups)")

List<Customer> findallByGroup(@Param("CompanyCode") int CompanyCode,@Param("groups") List<BigInteger> groups);

最佳答案

findAllByCompanyCodeAndFileCodeIn(int CompanyCode, List<String> groups)

你不需要@Query。 Spring Data 可以从方法名中理解查询。使用上面的方法。

关于spring - JPA JPQL IN 子句 : How to use IN clause in JPA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47992165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com