欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

org.springframework.orm.hibernate3.HibernateQueryException: Manager is not mappe 博客分类: SSH hibernatequeryexceptionhibernatetemplatespringframework 

程序员文章站 2024-02-24 21:42:40
...

 

用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");

 

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