日期:2014-05-18  浏览次数:20605 次

hibernate 关于 is not mapped的问题
        public List<Category> getAllCategorys() throws Exception {
String hql = "from Category";
List<Category> list = getHibernateTemplate().find(hql);
logger.info("category size: "+list.size());
return list;
}

我在程序中执行以上方法时,出现“ Category is not mapped [from Category] ”异常(我的实体类名就是Category)

请问是什么问题啊,,,,?

把“from Category”改成 “from com.fjx.music.models.Category”就没问题了。。。。。求解

applicationContext.xml配置

                <property name="packagesToScan">
<list>
<value>com.fjx.music.models</value>
</list>
</property>

使用struts2 + hibernate3 + spring2.5 (注解)

------解决方案--------------------
<list>
<value>com.fjx.music.models</value>
</list>
value值  应该为com.fjx.music.models.xxxx.xml (实体类的xml 配置)
------解决方案--------------------
Catalog你import成 com.sun.org.apache.xml.internal.resolver.Catalog了
------解决方案--------------------
引用:
引用:

Catalog你import成 com.sun.org.apache.xml.internal.resolver.Catalog了

能具体点吗、、、
倒是有这个可能,看看这个方法所在的类的import部分,看看是不是没有import你自己的Catalog
------解决方案--------------------
没hibernate配置文件
你注解只是将Category通过反射实例化
你Category对应的表没有!