Java Spring中Hibernate sessionFactory的配置

Java Spring中Hibernate sessionFactory的配置,java,hibernate,spring,Java,Hibernate,Spring,如何在春季配置hibernatesessionFactory,使其使用hibernate.cfg.xml进行配置(而不是applicationContext.xml中的配置设置)? 我将此属性添加到applicationContext.xml中的bean定义(sessionFactory)中。不过,它看起来并没有从hibernate.cfg.xml获取配置。实际上,我得到了“ClassNotFoundException:org.hibernate.cache.CacheProvider”,正如

如何在春季配置hibernate
sessionFactory
,使其使用
hibernate.cfg.xml
进行配置(而不是
applicationContext.xml
中的配置设置)?




我将此属性添加到applicationContext.xml中的bean定义(sessionFactory)中。不过,它看起来并没有从hibernate.cfg.xml获取配置。实际上,我得到了“ClassNotFoundException:org.hibernate.cache.CacheProvider”,正如我在hibernate.cfg.xml中为“NoCacheProvider”指定的那样。我使用的是“org.springframework.orm.hibernate3.LocalSessionFactoryBean”。在类名中更改为“hibernate4”而不是“hibernate3”时。我将这个属性添加到applicationContext.xml中的bean定义(sessionFactory)中。不过,它看起来并没有从hibernate.cfg.xml获取配置。实际上,我得到了“ClassNotFoundException:org.hibernate.cache.CacheProvider”,正如我在hibernate.cfg.xml中为“NoCacheProvider”指定的那样。我使用的是“org.springframework.orm.hibernate3.LocalSessionFactoryBean”。在类名中更改为“hibernate4”而不是“hibernate3”时。它起作用了(而不是转移到另一个错误)。
<property name="configLocation" value="classpath:hibernate.cfg.xml" />