Hibernate 和 EclipseLink 提供程序
我的项目中运行着 Hibernate,我正在尝试将其设置为可切换到 EclipseLink。我已经在 Maven 中添加了所有 EclipseLink 类,但它们似乎根本没有运行。当我尝试运行该项目时,结果是:
Exception in thread "main" javax.persistence.PersistenceException:
No Persistence provider for EntityManager named test
我的persistence.xml 文件:https ://gist.github.com/1676280
具有依赖项的 pom.xml 文件:https://gist.github.com/1676282
一旦我将 persistence.xml 中的提供程序切换回 Hibernate,一切都会正常工作。
I have a Hibernate running in my project and I am trying to set it up to be switchable to EclipseLink. I have added all EclipseLink classes in Maven, but it seems that they are not running at all. When I try to run the project, it ends up with:
Exception in thread "main" javax.persistence.PersistenceException:
No Persistence provider for EntityManager named test
My persistence.xml file: https://gist.github.com/1676280
The pom.xml file with the dependencies: https://gist.github.com/1676282
Once I switch the providers in the persistence.xml back to Hibernate, everything works correctly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在您的 persistence.xml 中发现一个重大问题和几个小问题。
最大的问题是您的持久性单元名为“org.knyttl”,但错误消息显示找不到持久性单元“test”。如果您正在寻找“test”并且 pu 是“org.knyttl”,那么您将找不到任何内容。 :)
小问题是您有几个 EclipseLink 属性命名错误。 “javax.persistence.target-database”应该是“eclipselink.target-database ”和“javax.persistence.logging.level”应该是“eclipselink.logging.level"。
肖恩
I see one significant issue and a couple of minor problems in your persistence.xml.
The big issue is the your persistence unit is named "org.knyttl" but the error message says persistence unit "test" can't be found. If you're looking for "test" and the pu is "org.knyttl" then you're not going to find anything. :)
The minor issues are that you have a couple of the EclipseLink properties misnamed. "javax.persistence.target-database" should be "eclipselink.target-database" and "javax.persistence.logging.level" should be "eclipselink.logging.level".
Shaun