I'm new to JPA (JPQL), so I got stacked with no good solution to maintain WHERE clause with a flexible comparison plan. I would like to implement a JPQL statement of the form like:
SELECT i FROM Item i
WHERE i.weight (comparison_operator_placeholder) :weight
AND i.height (comparison_operator_placeholder) :height;
(comparison_operator_placeholder):{ = | < | > | <= | >= }
The (comparison_operator_placeholder) shall be selected during runtime, based on user's input.
Intuitively I realize that no such grammar exists, however, there shall be other way than writing queries for each combination. I will appreciate any workaround.