Home query at postgres HOW in Spring JPA
Reply: 1

query at postgres HOW in Spring JPA

Serg Published in 2018-02-12 10:48:35Z

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...

Darkice Reply to 2018-02-15 13:47:01Z

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);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.332554 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO