camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From htit <>
Subject Apache Camel, CDI and @PersistenceContext/@Inject
Date Wed, 16 Apr 2014 07:09:59 GMT

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?



View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message