Hi, If this code successfully gets EclipseLink working would you consider contributing it to EclipseLink (or Aries, or perhaps both)?
It would be great to have more JPA providers that "just work". Regards, Tim ---------------------------------------- > Date: Mon, 13 Jun 2011 11:31:16 +0200 > From: [email protected] > To: [email protected] > Subject: Eclipselink and Aries JPA [was: OSGi JPA Service: Spec and > Implementation Mismatch] > > Hi Tim, > > thanks for your detailed comments. They help to understand the overall > situation and raise a couple of new questions - I need some time to > check out the references you've given, and then I'll get back. > > For now, just a quick remark on using Eclipselink with Aries JPA: I've > tried to simply register the Eclipselink PersistenceProvider as an OSGi > service, and this seems to do the trick both for Eclipselink 2.1.3 and > 2.2.0. > > I created a bundle containing nothing but the following Activator as a > replacement for org.eclipse.persistence.jpa.osgi. > > I haven't checked out more advanced things like weaving, but the sample > project I set up a few months ago with Aries and OpenJPA now also works > with Eclipselink. > > Regards, > Harald > > -------- > > package com.googlecode.osgienterprise.jpa.eclipselink; > > import java.util.Hashtable; > > import org.eclipse.persistence.jpa.PersistenceProvider; > import org.osgi.framework.BundleActivator; > import org.osgi.framework.BundleContext; > > public class Activator implements BundleActivator { > > public static final String PERSISTENCE_PROVIDER = > "javax.persistence.provider"; > public static final String ECLIPSELINK_OSGI_PROVIDER = > "org.eclipse.persistence.jpa.PersistenceProvider"; > private static BundleContext context; > > > @Override > public void start(BundleContext context) throws Exception { > Activator.context = context; > registerProviderService(); > } > > public void registerProviderService() throws Exception { > PersistenceProvider providerService = new PersistenceProvider(); > Hashtable props = new Hashtable(); > props.put(PERSISTENCE_PROVIDER, ECLIPSELINK_OSGI_PROVIDER); > > context.registerService("javax.persistence.spi.PersistenceProvider", > providerService, props); > } > > @Override > public void stop(BundleContext context) throws Exception { > } > > } >
