Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330790

Summary: Gemini JPA registers EMFBuilder service using its own bundle context
Product: [RT] Gemini.JPA Reporter: Sahoo <sanjeeb.sahoo>
Component: CoreAssignee: Michael Keith <michael.keith>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: eduard.bartsch, gunnar, thomas.gillet.2
Version: 1.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Sahoo CLA 2010-11-22 07:11:00 EST
I am trying out the Gemini/JPA sample. I am on Gemini/JPA 1.0.0.M3 and Felix. After I started the sample bundle, I was hoping to see EMFBuilder service being exported by the sample bundle, but as the following output shows, it is actually registered using Gemini's own bundle context:

g! inspect s c 7
Gemini JPA (Incubation) (7) provides services:
----------------------------------------------
javax.persistence.provider = org.eclipse.persistence.jpa.PersistenceProvider
objectClass = javax.persistence.spi.PersistenceProvider
osgi.jpa.provider.version = 1.0.0.M3-incubation
service.id = 16
----
objectClass = org.osgi.service.jpa.EntityManagerFactoryBuilder
osgi.managed.bundles = org.eclipse.gemini.jpa.samples_1.0.0.M3-incubation
osgi.unit.name = Accounts
osgi.unit.provider = org.eclipse.persistence.jpa.PersistenceProvider
osgi.unit.version = 1.0.0.M3-incubation
service.id = 17
Comment 1 Gunnar Wagenknecht CLA 2012-01-04 06:40:37 EST
Does the spec require the EMFBuilder service to be exported using the context of the bundle which defines the PU?
Comment 2 Michael Keith CLA 2012-01-04 11:18:04 EST
Strictly speaking it does. The reason was that it was supposed to ensure class space consistency when looking up the services, but in practice, because the entity classes are not part of the service, it wouldn't provide the consistency you would expect.
Comment 3 Thomas Gillet CLA 2012-10-09 10:44:12 EDT
I'm also concerned by this bug, because I'm trying to retrieve the persistence bundle used to publish an EMF/EMFB.

The workaround is to use the "osgi.managed.bundles" service property, but this is Gemini specific (and the property value needs parsing since it is formatted as "{bsn}_{version}").