Class OsgiSessionFactoryService

  • All Implemented Interfaces:
    org.osgi.framework.ServiceFactory

    public class OsgiSessionFactoryService
    extends Object
    implements org.osgi.framework.ServiceFactory
    Hibernate 4.2 and 4.3 still heavily rely on TCCL for ClassLoading. Although our ClassLoaderService removed some of the reliance, access to the proper ClassLoader via TCCL is still required in a few cases where we call out to external libs. An OSGi bundle manually creating a SessionFactory would require numerous ClassLoader tricks (or may be impossible altogether).

    In order to fully control the TCCL issues and shield users from the knowledge, we're requiring that bundles use this OSGi ServiceFactory. It configures and provides a SessionFactory as an OSGi service.

    Note that an OSGi ServiceFactory differs from a Service. The ServiceFactory allows individual instances of Services to be created and provided to multiple client Bundles.

    • Constructor Detail

      • OsgiSessionFactoryService

        public OsgiSessionFactoryService​(OsgiJtaPlatform osgiJtaPlatform,
                                         OsgiServiceUtil osgiServiceUtil)
        Constructs a OsgiSessionFactoryService
        Parameters:
        osgiJtaPlatform - The OSGi-specific JtaPlatform created in HibernateBundleActivator
        osgiServiceUtil - Util object built in HibernateBundleActivator
    • Method Detail

      • getService

        public Object getService​(org.osgi.framework.Bundle requestingBundle,
                                 org.osgi.framework.ServiceRegistration registration)
        Specified by:
        getService in interface org.osgi.framework.ServiceFactory
      • ungetService

        public void ungetService​(org.osgi.framework.Bundle requestingBundle,
                                 org.osgi.framework.ServiceRegistration registration,
                                 Object service)
        Specified by:
        ungetService in interface org.osgi.framework.ServiceFactory