I read many other questions in stackoverflow regarding my problem, but I did not find the right solution.
I am developing an OSGI application (Equinox) and am using JPA (EclipseLink). Now I ask for the best way to get EntityManager in packages that require it. When I publish the EntityManagerFactory service as a service and use it to get EntityManger, I have to provide persistence.xml in every bundle where I use EntityManager. When I write a utitlity class that shares a single EntityManger instance and publishes it as a service, I am afraid to run into thread synchronization issues.
Are there any recommendations for providing EntityManager when using OSGI and JPA?
thanks
Dan
source share