I am writing a small OSGi application for learning purposes. I sucessfully set up Gemini JPA and the DBAccess Services to use JPA, and it is working fine, as long as i use a persistence.xml to configure my persistence units.
Then i stumbled across This Example. It seems like a really great feature to provide a persistence unit configuration at runtime. Except it is not working. I tried that exact code (for the Standalone Configuration), and it is executed, but nothing changes in the framework. As far as i understand, shouldn't there be a new service providing the new Persistence Unit?
I' am using the Equinox framework, all necessary bundles for gemini and dbaccess are installed and running, and the ConfigurationAdmin bundle (org.eclipse.equinox.cm
) is installed and running at the point my code is executed.
I access the Configuration Admin like this:
ServiceReference<ConfigurationAdmin> s = context
.getServiceReference(ConfigurationAdmin.class);
ConfigurationAdmin admin = context.getService(s);