I am new to JPA and need assistance writing following query. I am on wildfly, javaEE with hibernate behind etc etc.. The idea is to have a where inside my select statement with two conditions. The first condition shall be matched first against all rows and then in case nothing is found the second one shall be matched against all rows.
for example (pseudo code):
select * from myTable
where (con1) and (if no con1 try match con2)
rows matching con1 shall be returned because con1 has prio
rows matching both conditions shall never be returned
how to write such a query in jpa 2.1? thanks in advance