这是我的 HQL:
Query query = createQueryOnCurrentSession("DELETE Email e " +
"where " +
"(status = :sent and creationTime <= :creation)" +
"or " +
"(status = :error and maxEttempts >= :maxEttempts)");
这是生成的 SQL:
delete from `email` where `status`=? and `creation_time`<=? or `status`=? and `attempts`>=?
问题:为什么括号不在SQL中?我希望它是:
delete from `email` where (`status`=? and `creation_time`<=?) or (`status`=? and `attempts`>=?)
可以替代我将在 2 个请求中删除吗?
delete from `email` where `status`=? and `creation_time`<=?
delete from `email` where `status`=? and `attempts`>=?