日期:2014-05-17  浏览次数:20584 次

hibernate错误
String hql ="from TaskInfo as a where a.tno=:tno";
if(term!=null||!"".equals(term)){
hql = "from TaskInfo as a where a.tno=:tno and a.term=:term";
}
Query query = session.createQuery(hql);
System.out.println(user.getTno());
query.setString("tno", user.getTno().trim());
query.setString("term", term);
tx = session.beginTransaction();
result = query.list();
if(!Hibernate.isInitialized(result)){
Hibernate.initialize(result);
}
tx.commit();



后台报错
org.hibernate.QueryException: could not resolve property: tno of: com.ORM.TaskInfo [from com.ORM.TaskInfo as a where a.tno=:tno and a.term=:term]

是什么错误?

------解决方案--------------------
QueryException: could not resolve property: tno of: com.ORM.TaskInfo [from com.ORM.TaskInfo as a where a.tno=:tno and a.term=:term]

映射文件没有tno属性吧。