Hi Bryan,
We've coded to generic OSGi and AFAIK there is no generic way to say
a bundle should be started. But I don't see any reason why we couldn't
include an Equinox (or other implementation specific) manifest entry
though. Can you file bug for this? We also need to start the
org.eclipse.persistence.jpa bundle.
In answer to your question: yes you do need to start the bundle
yourself. I set this as part of my launch configuration for OSGi apps
using PDE. It seems to be harder in an RCP app as the PDE launcher
doesn't let you set start levels. You seem to have to put everything
into a config.ini file. I'd love to hear about a simpler way.
FYI, the resolver behind javax.persistence.Persistence sets up a
service tracker that provides an OSGi friendly way of locating
persistence providers. If you don't care if you're directly coupled to
EclipseLink then you can go around the JPA SPI interface and directly
instantiate org.eclipse.persistence.jpa.osgi.PersistenceProvider and
create your EntityManagerFactory. This is probably the simplest thing
to do in an RCP app as it is "service-less". However you do need to
pass in a classloader that can see your persistence.xml, orm.xml, and
Entities, e.g.,
HashMap<String, Object> properties = new
HashMap<String, Object>();
ClassLoader classLoader = this.getClass().getClassLoader();
properties.put(PersistenceUnitProperties.CLASSLOADER,
classLoader);
new
PersistenceProvider().createEntityManagerFactory(puName, properties);
Shaun
Bryan Hunt wrote:
The Activator in javax.persistence sets the provider
resolver to the Activator, but the manifest is set to not automatically
activate the bundle. Is the default provider resolver supposed to be
used, or do I manually have to start the bundle?
Bryan
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Shaun Smith | Principal Product Manager, TopLink |
+1.905.502.3094
Oracle Fusion Middleware
110 Matheson Boulevard West, Suite 100
Mississauga, Ontario, Canada L5R 3P4
|