admin管理员组

文章数量:1566353

          最近在用hibernate的时候,使用hql语句查询数据库,

   1.遇到node to traverse cannot be null 错误,出现这种错误说明是HQL语句的问题,引起内部查询对象为空,无法处理空值引起的,解决方法就是检查HQL语句(尤其是关键字).

   2.遇到Unable to locate appropriate constructor on class错误。

     我还记得当时使用的String hql = "select new Event(email) from Event e where e.id=1 and e.address=mmm";

     造成该错误的原因在于我要查询Event实体的email属性或集合,但是你的实体里面并没有该构造方法。解决方法就是在我的Event类中加入该构造方法 public Event(String email){this.email=email;}搞定!



 

本文标签: 解决方案错误constructorlocateunable