spring“persistence.xml”文件的位置

时间:2013-10-28 04:47:16

标签: spring jpa

在STS 3.4.0.RELEASE(Spring)下开发Web应用程序。我在Eclipse Juno下运行了JPA示例,并希望将其作为Spring应用程序的一部分进行移植。我必须复制persistence.xml文件。应该在哪里准确定位?

到目前为止,我得到了“javax.persistence.PersistenceException:没有名为...的EntityManager的持久性提供程序”,这可能与位置有关,也可能不是。

是否需要“provider”元素,如果是,那么值应该是什么? (它在没有该元素的Eclipse下运行良好)。

请帮助!!!

2 个答案:

答案 0 :(得分:0)

persistence.xml文件应放在类路径的META-INF/persistence.xml中。

答案 1 :(得分:0)

您的persistence.xml无效,无法创建EntityManagerFactory

请参阅此类似问题Cause of this Exception

希望有所帮助......