Not exactly. You mainly have to separate the @Entity classes from the classes that use @PersistenceContext.

1. a bundle containing persistence.xml and @Entity classes
2. a bundle containing the DAO classes that use the EntityManager with @PersistenceContext.

A third bundle that uses the DAO would also be separated but it could also be colocated by just injecting the bean.

You should not deploy the blueprint.xml as a separate file or bundle as this would violate the isolation. It would mean that
you need to expose your DAO impl packages.

You can find a complete example here:
https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-blueprint-cdi

A you see I put the @Entity classes in the same bundle as the DAO interface. In my case this makes sense anyway as the @Entity classes are part of the public api anyway.

Christian

Am 14.11.2015 um 16:49 schrieb conejo:
Hello. Thank you for the explanation.

You mean if I want to use version 2.2.0 I have to do the following?

1. A blueprint bundle containing the persistence unit and DAO objects.
2. A blueprint bundle setting out the service that uses the DAO.

The DAO objects are using the entityManager and therefore have the
annotation @PersistenceContext

Another option (I guess) could leave everything as is but leaving
dataService.xml file defining the service as a separate bundle (or even
deployed in the deploy folder)



--
View this message in context: 
http://karaf.922171.n3.nabble.com/4-0-3-Karaf-JPA-problem-tp4043497p4043516.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to