1

there is here such a request:

select *
from Organization t
where (t.inn,t.kpp) IN(('000000','00000'),('1111111','111111'));

How make this Query in Spring Data JPA. I tried like this:

@Query(value =
"SELECT t" +
    " FROM Organization t" +
    " WHERE (t.inn, t.kpp) IN :innKppList")

List findOrganizationsByInnKpp(@Param("innKppList") Map innKppList);

But it does not work...

2
  • Jpql 'in' is for a single value in a collection Commented Feb 12, 2018 at 10:59
  • also , refer to this post stackoverflow.com/a/48540115/493216 Commented Feb 12, 2018 at 11:00

1 Answer 1

0

If you can split up your map into two lists this will work

@Query("SELECT t FROM Organization t WHERE t.inn IN ?1 AND t.kpp IN ?2")
Set<Organization> findByInnAndKpp(List<String> inn, List<String> kpp);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.