SSH中调用DAO类中的方法为什么总是报错

lv6917527 2015-02-03 05:54:12
做一个登录,有时候有用,有时候又报错。
报错提示:
org.springframework.orm.hibernate3.HibernateQueryException: TbuserInfo is not mapped [from TbuserInfo as model where model.userId= ?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: TbuserInfo is not mapped [from TbuserInfo as model where model.userId= ?]
代码:
public class Allservice
{
private TbuserInfoDAO userdao;

public void setUserdao(TbuserInfoDAO userdao) {
this.userdao = userdao;
}

public String login(TbuserInfo users){
List<TbuserInfo> list = userdao.findByProperty("userId",users.getUserId());
if(list.get(0).getPassword().equals(users.getPassword())&&list.size()!=0&&list!=null)
{
ActionContext.getContext().getSession().put("alluser",list);
return "success";
}
return "error";
}
DAO中的findByProperty代码:
public List findByProperty(String propertyName, Object value) {
log.debug("finding TbuserInfo instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from TbuserInfo as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
action中的代码:
public String login()
{
String flg = allservice.login(users);
if(flg.equals("success"))
{
return "success";
}
return "error";
}
...全文
147 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

10,607

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧