问答详情
源自:5-2 配置去掉Hibernate的配置文件-Spring整合Hibernate

是架包冲突吗

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.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister


提问者:qq_奋斗吧小青年_0 2017-04-07 19:52

个回答

  • Sophomore
    2017-04-23 23:42:10

    因为spring在3.1之后的版本中把 AnnotationSessionFactoryBean与LocalSessionFactoryBean集成到了一起,统一用org\springframework\orm\hibernate4\LocalSessionFactoryBean。 不再有AnnotationSessionFactoryBean类; 但是org.springframework.orm-3.1.1.RELEASE.jar 依然保留有org\springframework\orm\hibernate3这个包,这是为了向下兼容。所以改成hibernate4即可!

  • 二没那么简单
    2017-04-07 23:06:17

    我也报了这个错误,也在网上查过,感觉有八成是各个bean里的书写错误。仔细排查可能会找到