org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Use of the same entity name twice: RegionData
==============================================
多是映射文件配置错误。
检查hibernate.cfg.xml和映射文件RegionData.hbm.xml配置情况。
如果hibernate.cfg.xml里的<mapping class=和<mapping resource=没错的话,多是RegionData.hbm.xml里<class name="。。。。RegionData“...这里RegionData.java的路径写错了。
http://hi.baidu.com/jsjok/blog/item/e24e1b3fe22bdbdd9e3d622d.html
本文解决在使用Spring框架时遇到的BeanCreationException问题,具体为在applicationContext.xml中定义的sessionFactory创建失败,原因是RegionData实体名在不同配置文件中被重复使用。通过检查hibernate.cfg.xml和RegionData.hbm.xml中的配置来定位并修正错误。
2933

被折叠的 条评论
为什么被折叠?



