休眠-CDI
我有一些 Hibernate Envers 侦听器,用于审计目的。我刚刚开始使用 CDI,到目前为止,它的简单性和强大功能让我感到惊喜。由于似乎一切都在集成 CDI 功能,我想我应该提出一个问题,Hibernate 是否支持它?
不仅可以访问各种组件,而且可以轻松访问其他上下文信息并且不受 Hibernate 接口的限制也很好。
I have a few Hibernate Envers listeners which I use for audit purposes. I am just getting started on CDI and so far am pleasantly surprised by its simplicity and power. Since it seems everything is integrating CDI functionality, I thought I'd raise the question, is Hibernate supporting it or will it?
Not only would it be nice to have access to various components, but it would also be great to have access to other contextual information easily and not be limited by Hibernate's interfaces.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题应该是相反的 - CDI 是否支持休眠集成。
CDI 必须支持的(可能通过扩展)是:
@PersistenceContext
的地方注入EntityManager
,在有@PersistenceContext
的地方注入EntityManagerFactory
>@PersistenceUnitGoogle 的“Weld Persistence Context”,您将获得一些如何将 Hibernate (JPA) 与 Weld 结合使用的示例,Weld 是 CDI 的参考实现。另请阅读此帖子。以及这个示例
The question should be the other way around - will CDI support hibernate integration.
What CDI has to support, probably via an extension, is:
EntityManager
where there is@PersistenceContext
, andEntityManagerFactory
where there is@PersistenceUnit
Google for "Weld Persistence Context" and you'll get some examples of how to use Hibernate (JPA) with Weld, which is the reference implementation of CDI. Read this thread as well. And this example