Hibernate 和 EclipseLink 提供程序

发布于 2024-12-28 16:18:43 字数 573 浏览 1 评论 0原文

我的项目中运行着 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幻梦 2025-01-04 16:18:43

我在您的 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文