求大神,帮忙看下出了什么问题?关于 HQL 语句的查询
代码:public class testHQL2 {
public static void main(String[] args) {
AbstractApplicationContext act= new ClassPathXmlApplicationContext("applicationContext.xml");
ListDao listDao = (ListDao) act.getBean("ilistdao");
String HQL = "SELECT new List(MB001,ISNULL((SELECT ISNULL(SUM(MC007),0) FROM INVMC WHERE MC001=MB001),'')) FROM INVMB B ";
List<List<Object>> data = listDao.findByHQL(HQL, new Object[]{});
if(data!=null && data.size()>0){
for(int i=0;i<10;i++){
System.out.println(data.get(i));
}
}
System.out.println("END");
}
}
错误提示:
java.lang.NullPointerException
at org.hibernate.hql.NameGenerator.generateColumnNames(NameGenerator.java:46)
at org.hibernate.hql.ast.util.SessionFactoryHelper.generateColumnNames(SessionFactoryHelper.java:409)
at org.hibernate.hql.ast.tree.SelectClause.initializeColumnNames(SelectClause.java:269)
at org.hibernate.hql.ast.tree.SelectClause.finishInitialization(SelectClause.java:259)
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:253)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:831)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:619)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:672)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
at org.hibernate.hql.ast.(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
at DAO.ListDaoImpl.findByHQL(ListDaoImpl.java:22)
at testAnythings.testHQL2.main(testHQL2.java:17)