在我的项目中,我使用JPA 1.0与Hibernate 3.2.x和Tomcat进行部署。
在我的项目中,我使用以下查询作为命名查询执行,
SELECT smSSTJob.smJob.jobId, smSSTJob.smJob.jobTypeId, smSSTJob.omObject.objectId,
smSSTJob.omObject.objectName FROM SMSSTJob smSSTJob
WHERE smSSTJob.smJob.jobTypeId IN (:jobTypeIdList)
AND smSSTJob.jobStatusId IN (:jobStatusList)
AND smSSTJob.omObject.objectId NOT IN (SELECT sm.omObject.objectId FROM SMSSTJob sm
WHERE sm.jobStatusId IN (:unProcessedJobStatusList)
AND sm.responseReceivedDate > :responseReceivedDate)
AND smSSTJob.priority = :priority
AND smSSTJob.jobRetries < :maximumJobRetries ORDER BY smSSTJob.smJob.jobId
当我部署我的项目导致上述查询hibernate时,以下异常,
Caused by: java.lang.NullPointerException
at org.hibernate.hql.ast.tree.FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements(FromClause.java:120)
at org.hibernate.hql.ast.tree.FromClause.getFromElement(FromClause.java:107)
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:81)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4253)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4161)
如何解决此异常?有人请在这方面帮助我。 提前谢谢。
答案 0 :(得分:0)
Hibernate中有bug,在3.2.6及更高版本中解决,尝试更新Hibernate版本
答案 1 :(得分:-2)
可能是一个“)”丢失了吗?关闭子查询。
NOT IN(从SMSSTJob sm中选择sm.omObject.objectId) WHERE sm.jobStatusId IN(:unProcessedJobStatusList)