Reputation:
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.
Upvotes: 3
Views: 2374
Reputation: 597124
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
, and EntityManagerFactory
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
Upvotes: 2