tolerate Set + Collection for multivalued @Query parameters
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
cf4af826fe
commit
dcacbadd5f
|
@ -2665,6 +2665,8 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
final String argType = stripTypeAnnotations(argumentType);
|
||||
return param.allowMultiValuedBinding()
|
||||
? isLegalAssignment(argType, LIST + '<' + queryParamType + '>')
|
||||
|| isLegalAssignment(argType, SET + '<' + queryParamType + '>')
|
||||
|| isLegalAssignment(argType, COLLECTION + '<' + queryParamType + '>')
|
||||
: isLegalAssignment(argType, queryParamType);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,10 @@ import org.hibernate.query.SelectionQuery;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public interface Dao {
|
||||
|
@ -56,6 +58,15 @@ public interface Dao {
|
|||
@Find
|
||||
SelectionQuery<Book> createBooksSelectionQuery(String title);
|
||||
|
||||
@HQL("where isbn in ?1")
|
||||
List<Book> booksGivenIsbnList(List<String> isbns);
|
||||
|
||||
@HQL("where isbn in :isbns")
|
||||
List<Book> booksGivenIsbnSet(Set<String> isbns);
|
||||
|
||||
@HQL("where isbn in :isbns")
|
||||
List<Book> booksGivenIsbnCollection(Collection<String> isbns);
|
||||
|
||||
@HQL("where title like ?1")
|
||||
List<Book> findBooksByTitle(String title);
|
||||
|
||||
|
|
Loading…
Reference in New Issue