title: Best practice to provide EntityManager in OSGI applications
body: <p>I have read a lot of other questions at stackoverflow concerning my problem but I didn’t find a proper solution.</p>
  
  <p>I development an OSGI Application (Equinox) and use JPA (EclipseLink). Now I ask for the best way to get the EntityManager in the bundles which require it. When I publish the EntityManagerFactory as service and use it to get the EntityManger I have to provide the persistence.xml in every bundle where I use the EntityManager. When I write an utitlity class sharing one instance of an EntityManger and publish it as service I am afraid to run into thread synchronization problems.</p>
  
  <p>Is there any kind of best practices to provide the EntityManager when using OSGI and JPA?</p>
  
  <p>Thanks</p>
  
  <p>Dan</p>