首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

hibernate异常

2012-03-03 
hibernate错误String hql from TaskInfo as a where a.tno:tnoif(term!null||!.equals(term)){hql

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属性吧。

热点排行