문제

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.

도움이 되었습니까?

해결책

The question should be the other way around - will CDI support hibernate integration.

What CDI has to support, probably via an extension, is:

  • injecting an EntityManager where there is @PersistenceContext, and EntityManagerFactory where there is @PersistenceUnit
  • transaction and session lifecycle handling

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top