session = super.getSession(); //得到session ts = session.beginTransaction(); //开始事务 //hql查询语句 String hql= "select da.dateTime,en.enterpriseName,con.contractName,con.tixiName from DateTime as da,EnterInformation as en,ContractInformation as con where dateTime like'%"+year+"%' and da.enterName = en.enterpriseName and con.enterName=en.enterpriseName and con.enterName = da.enterName"; Query que = session.createQuery(hql); //创建query对象 //que = session.createQuery(hql); //que = session.createSQLQuery(hql); //不用这一句吧!!! List list = que.list(); //执行查询,得到结果 return list; 可是运行却出现这样的异常:org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'null.enterName' [from com.nanjing.struts.entity.DateTime,com.nanjing.struts.entity.EnterInformation as en,com.nanjing.struts.entity.ContractInformation as con where dateTime like'%2005%' and DateTime.enterName = en.enterpriseName and con.enterName=en.enterpriseName and con.enterName = DateTime.enterName] org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59) org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:225) org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158) org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109) org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:75) org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:54) 是不是你的enterName是空,或者是类型不匹配
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....