HQL中的括号不会转换为SQL

uri*_*rir 6 java hibernate

这是我的HQL:

Query query = createQueryOnCurrentSession("DELETE Email e " +
                "where " +
                "(status = :sent and creationTime <= :creation)" +
                "or " +
                "(status = :error and maxEttempts >= :maxEttempts)");
Run Code Online (Sandbox Code Playgroud)

这是生成的SQL:

delete from `email` where `status`=? and `creation_time`<=? or `status`=? and `attempts`>=?
Run Code Online (Sandbox Code Playgroud)

问题:为什么括号不在SQL中?我希望它是:

delete from `email` where (`status`=? and `creation_time`<=?) or (`status`=? and `attempts`>=?)
Run Code Online (Sandbox Code Playgroud)

也许我会在2个请求中删除?

delete from `email` where `status`=? and `creation_time`<=?
delete from `email` where `status`=? and `attempts`>=?
Run Code Online (Sandbox Code Playgroud)

Jaa*_*nus 9

这实际上是一个功能.

由于and优先权or,hibernate知道它,并删除括号.

你不需要那些括号.