HQL and Criteria can only work when specifying the actual Entity property / Table column, so this does not work:
:param IS NULL
If id_or_smth is a column of Table1, then your query should look like this:
Query q = entityManager.createNativeQuery("SELECT id FROM table1 WHERE id_or_smth IS NULL or id_or_smth = :param");
q.setParameter("param", paramValye);
q.getResultList();
paramValue .
SQL IS NULL/IS NOT NULL, :
SELECT id FROM table1 WHERE id_or_smth = NULL
, , id_or_smth IS NULL