`

org.springframework.orm.hibernate3.HibernateQueryException: Manager is not mappe

    博客分类:
  • SSH
阅读更多

 

用hibernateTemplate().find()方法时出现以下错误

org.springframework.orm.hibernate3.HibernateQueryException: Manager is not mapped [from Manager]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Manager is not mapped [from Manager]

 

纠结了好长时间,上网一查才知道好多人出现过相同问题,原因一般有:

 

1,hbm.xml 没在beans.xml中配置

 

可我有啊

 

<property name="packagesToScan">

<list><value>com.fzb.shop.entity</value></list> 

 </property>

 

 

2,find()方法中的类名未写全

 

我原来是

this.getHibernateTemplate().find("from Manager");

 

应该为

this.getHibernateTemplate().find("from com.fzb.shop.entity.Manager");

 

但还是有些纠结,以后难道每个类名都得写全吗?有其他办法吗?


 

分享到:
评论
2 楼 Armourstill 2013-06-13  
hibernateTemplate的查找是面向对象而不是数据表的,find的参数“from xxx”其实xxx不是表名而应该是类名
1 楼 jayyunfei 2013-05-08  
我这里不用写啊,是不是你配置文件没有写路径啊?

相关推荐

Global site tag (gtag.js) - Google Analytics