You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by htit <ha...@tijink.com> on 2014/04/16 09:09:59 UTC

Apache Camel, CDI and @PersistenceContext/@Inject

Hi,

I have the following situation:
- a full fledged JEE webapplication that uses CDI, JSF and JPA/Hibernate for
persistence (it does NOT use any Spring components)
- a goal of using Apache Camel for some processing

I have a standalone Apache Camel application running perfectly. It uses
camel-cdi and DeltaSpike. Jetty is used as a In endpoint, an embedded
ActiveMQ queue is used for, well, queueing and beans are injected by CDI to
process the information. 

Next, I wanted to add my domain model and persistence from the JEE webapp to
the Camel application. And the trouble begins (for me at least). The JEE
webapp uses @PersistenceContext to inject the EntityManager into DAOs. This
is the container-managed EntityManager, this is not available in the
DeltaSpike/Camel combo.

Within Apache Camel, to inject an EntityManager, I can create a
EntityManagerProducer that @Produce's an EntityManager. But that needs to be
@Inject'ed, not @PersistenceContext'ed.

Unfortunately, I can not change the JEE webapplication.

Are there any ideas/pointers to how integrate the two applications so I can
reuse the domain model and DAO/persistence layer?

Regards,

Harald



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-CDI-and-PersistenceContext-Inject-tp5750279.html
Sent from the Camel - Users mailing list archive at Nabble.com.