users@glassfish.java.net

OSGi Persistence Bundles

From: Harald Wellmann <harald.wellmann_at_gmx.de>
Date: Mon, 13 Jun 2011 22:51:10 +0200

Does Glassfish 3.1 support OSGi Persistence Bundles according to the
OSGi Enterprise JPA Service Spec?

After deploying a JAR with a persistence unit and the required OSGi
headers to Glassfish as OSGi bundle, I was expecting to see an
EntityManagerFactory for this persistence unit in the service registry,
but I didn't.

After reading

http://wikis.sun.com/download/attachments/209655166/GF-OSGi-Features-1.0.pdf

and looking at the code samples, it seems only EJB JARs and WARs can be
hybrid bundles, but persistence units/bundles are not...?

In one of the EJB code samples, the classes from a persistence unit were
copied into the bundle, which is not really what you want.

When a persistence bundle gets deployed, the container should register
the EMF in the OSGi service registry, and hybrid EJB bundles should be
able to inject a @PersistenceContext via the OSGi service registry.

Is this possible at all, or on the roadmap at least?

BTW: Sahoo, thanks a lot for writing this OSGi Features document - the
official GlassFish docs don't give much space to OSGi, so your overview
is extremely helpful.

Regards,

Harald