How to Create Dynamic Queries When Parameters are Listed, If We Have Multiple Comboboxes, For each Combobox to be Selected, an and must be added to the query that does not work in jpql enter image description here
Asked
Active
Viewed 389 times
-2
-
please upload your code too, so we can see if what you want clearly! – sovannarith cheav Oct 16 '19 at 08:30
2 Answers
0
The proper JPA query format would be:
SELECT t FROM table_name t WHERE t.val IN :list;
where :list is your list of values.

sovannarith cheav
- 743
- 1
- 6
- 19
-
-
@fariba I mean to use datatype List, ex: List atmTypeIdList . And you should write you code to prevent error from user input too. – sovannarith cheav Oct 16 '19 at 09:59
0
You won't be able to do it directly, for that you need to use JPA specification using it you can achieve dynamic parametric query.
Refer this link from Specification: https://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/

K.D
- 407
- 3
- 10