我想将以下oracle sql查询转换为jpql。我为DC_Subjects创建了实体,SUBJECT_SERIAL_NUMBER是DC_Subjects中的一列。我知道当表的实体模型存在时如何将sql转换为jpql。但在这种情况下,我已经使用了dual,rownum等。我不知道如何将它转换为jpql。
SQL查询:
select n from
( select rownum n from dual connect by level <= (select max(SUBJECT_SERIAL_NUMBER) + 2 from DC_Subjects))
where n >= 3000 minus (select subject_Serial_Number from DC_Subjects where version_End = '31-DEC-3099 12.00.00.000000000 AM');