迁移 EJB2.x BMP 实体 bean

发布于 2024-07-11 05:07:42 字数 438 浏览 5 评论 0原文

我们使用带有 BMP(bean 管理持久性)的 EJB2.x 实体 bean。 EJB3 似乎不支持 BMP。 我们希望保持最新状态并升级到 EJB3。 有谁知道 3.0 中实际上是否有可用的 BMP 选项?

据我所知,使用 3.0,所有实体 bean 都必须使用 JPA 和定义的 ORM。 有一些选项可以使用本机 SQL,但这仍然只是使用 JPA 实现 ORM 的一种方法。

我不确定是否有另一种 EJB3 方法可以实现与 EJB2.x BMP 实体 bean 相同的功能。 目前,我们使用标准 ejbStore 方法通过本机 SQL 更新数据库,并使用 ejbLoad 方法查找所有 bean 并在事务回滚时刷新 bean。 我认为您也许可以使用 EJB3 会话 bean 来做到这一点,但我不确定。

也许我们不应该迁移到 EJB3 bean,而应该迁移到 Spring。

We use EJB2.x entity beans with BMP (bean managed persistence). It appears BMP is not supported in EJB3. We had wanted to stay current and upgrade to EJB3. Does anyone know if there are in fact any BMP options available in 3.0?

From what I can tell, using 3.0, all entity beans have to use JPA and by definition ORM. There are some options to use native SQL but that is still just a way to use JPA to implement ORM.

I wasn't sure if there is another EJB3 approach to achieve the same functionality as with EJB2.x BMP entity beans. We currently use the standard ejbStore method to update the DB through native SQL and the ejbLoad method to lookup all beans and to refresh the bean in the event of a transaction rollback. I thought you might be able to do this with EJB3 session beans but I wasn't sure.

Perhaps instead of migrating to EJB3 beans we should migrate to Spring.

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

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

发布评论

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

评论(2

苯莒 2024-07-18 05:07:42

如果您确实想手动编写 SQL 代码,请选择 POJO 和原始 JDBC DAO。 但这也可能是一个重新思考做事方式并拥抱 ORM/JPA 的机会。

If you really want to code SQL by hand, go for POJOs and raw JDBC DAOs. But this is also maybe an opportunity to rethink the way you're doing things and embrace ORM/JPA.

感受沵的脚步 2024-07-18 05:07:42

过去,我使用 JTA 混合了 Hibernate + EJB2(CMP + BMP)共享事务上下文,没有出现任何问题。

这个问题很相似...
查看 https://cwiki.apache。 org/GMOxDOC22/developing-bean-management-persistence-with-jpa.html。 您可以实现自己的EntityManager。

幸运的话,您甚至可以共享事务上下文。

In the past, I have mixed Hibernate + EJB2 (CMP + BMP) sharing transactional contexts with no issues, using JTA.

This problem is quite similar...
Take a look at https://cwiki.apache.org/GMOxDOC22/developing-bean-managed-persistence-with-jpa.html. You can implement your own EntityManager.

With luck, you may be even able to share transactional contexts.

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