I would like to make a Query in JpaRepository in Spring.
For example i give 2 lists of Strings:
titles{"Wit", "Bbi"}
authors{"sa","kIEn"}
and I receive list of authors from db:
1{"Sapkowski"}
2{"Tolkien"}
Is it possible with a query like this? something like adding LIKE CONCAT('%', UPPER(:tag), '%') ignoring cases, etc. but to check a whole list?
@Query("SELECT b.author FROM BookDB b WHERE b.title IN :titles AND b.author IN :authors")
List<String> findAuthorsByTitlesAndAuthors(@Param("titles ") List<String> titles ,
@Param("authors") List<String> authors);
Or maybe method names? I cannot figure it out...
I would like to make it in the best way bearing in mind performance in a bigger data and code readability.
Thanks in advance.
findAuthorsByTitlesIgnoreCaseAndAuthorsIgnoreCase