JPQL查询无效。执行查询时出现无法创建对象的错误

时间:2015-08-21 17:20:42

标签: java sql jpql

我正在尝试将SQL查询转换为JQL,虽然我的代码编译,但是当执行查询时,会出现关于它无法创建我想要的类型的对象的错误。

{{1}}

1 个答案:

答案 0 :(得分:0)

JPQL没有'ON'运算符。你可能想要的是:

SELECT js
FROM TableObject js
WHERE js
IN (
    SELECT jsa 
    FROM TableObject jsa 
    JOIN TableObject jsb 
    WHERE (
        jsa.job = jsb.job 
        AND jsa.key='power'
        AND jsa.value=:keyValue1 
        AND jsb.key = 'defense'
        AND jsb.settingValue=:keyValue2
    )
) AND js.job IN (
    SELECT j 
    from OtherTableObject j
    where j.type = :type
)
ORDER BY js.createDate DESC