不使用 Spring 配置 JPA 和 JOTM

发布于 2024-08-24 07:40:59 字数 252 浏览 8 评论 0原文

谁能给我提供一个在未使用 Spring 的环境中配置 JPA/JOTM 的示例吗?

我正在使用 Tomcat 和 JPA/MySQL 构建一个网络应用程序。目前,我只是在 JPA 持久性单元中使用 RESOURCE_LOCAL 事务,但如果可能的话,我想迁移到真正的事务管理器 (JOTM)。我查遍了整个网络,似乎能找到的都是使用 Spring 的示例。

有人能指出我正确的方向吗?

谢谢

Can anyone point me to an example of configuring JPA/JOTM in an environment where Spring isn't being used?

I'm building a web-app with Tomcat and JPA/MySQL. Currently I'm just using the RESOURCE_LOCAL transactions in the JPA persistence unit, but I'd like to move to a real transaction manager (JOTM) if possible. I've looked all over the web and all I seem to be able to find are examples using Spring.

Can anyone point me in the right direction?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

调妓 2024-08-31 07:40:59

JBoss 有一篇有趣的文章,展示了如何使用各种独立事务管理器配置 Hibernate,包括 JOTM(文章涵盖的内容不仅限于但很好,能做更多的人可以做得更少),以及没有 Spring。

但实际上,我的建议是使用 Atomikos(本文介绍过)而不是 JOTM,因为它是一个很棒的产品,并且:

它是目前我通过在线文档找到的唯一事务管理器,如何在任何 J2EE 容器之外与 Hiberante 集成,无需 Spring。它似乎是唯一支持 XaDataSource 和 Pooling 的,所以它没有自带 JNDI 实现也没关系(在下面的示例中我们将使用 JBoss 的实现)。

以防万一,我在之前的答案中写了有关独立事务管理器的文章。

JBoss has an interesting article showing how to configure Hibernate with various standalone transaction managers, including JOTM (the article covers more than than but well, he who can do more can do less), and WITHOUT Spring.

But actually, my suggestion would be to use Atomikos (which is covered by the article) instead of JOTM because it's a great product and:

It is currently the unique Transaction manager I've found with a online-documentation, how to integrate with Hiberante without Spring, outside any J2EE container. It seems to be the unique supporting XaDataSource together with Pooling, so it doesn't matter that It does not come with it's own JNDI implementation (we will use the one of JBoss in following example).

Just in case, I wrote about standalone transaction managers in this previous answer.

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