Java – multiple in conditions in jpql
•
Java
How to express the following SQL in jpql:
select * from table where ( ( table.col1,table.col2) in (col1val1,col2val1),(col1val2,col2val2),(col1val3,col2val3) )
BTW: the above is a valid Oracle SQL syntax
Solution
My jpql is terrible, but it is as follows:
select tableDto from TableDto tableDto where (tableDto.col1 = col1val1 and tableDto.col2 = col2val1) or (tableDto.col1 = col1val2 and tableDto.col2 = col2val2) or (tableDto.col1 = col1val3 and tableDto.col2 = col2val3)
It's not beautiful
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码