我正在尝试从java执行以下HQL查询。
"SELECT ac.accountNumberInt,ag.ext,sum (ext) as exta from CustomerCapital ag,Account ac where customerExt =:customerExt and observationPeriod in (:observationPeriod) group by ac.accountNumberInt,ag.ext";
它抛出了以下异常。
java.lang.NullPointerException:在org.hibernate.dialect.Dialect$3.getReturnType(Dialect.java:125) ~hibernate-Core.jar!org.hibernate.hql.ast.util.SessionFactoryHelper.findFunctionReturnType(SessionFactoryHelper.java:405)处的java.lang.NullPointerException为空~hibernate-core.jar!/:3.3.1.GA
有人能在这方面给我指点一下吗?
发布于 2013-06-25 20:48:47
ag.ext不能既在group by中,又在聚合函数中。如果是这样,您需要使用类别名来指出它
you can't have ambiguous fields : sum (ext) ==> sum (ac/ag.ext)
observationPeriod ==> ac/ag.observationPeriod
customerExt ==> ac/ag.customerExt https://stackoverflow.com/questions/12526340
复制相似问题