[hibernate-dev] hibernate-osgi JPA bootstrap & classloader

Brett Meyer brmeyer at redhat.com
Tue May 26 11:44:13 EDT 2015


IIRC:

OsgiPersistenceProvider and OsgiSessionFactoryService both need *some* way to build the OsgiClassLoader and pass it into Hibernate bootstrapping.  For the SF, that's easy: just hand OSGiClassLoaderServiceImpl to BootstrapServiceRegistryBuilder.  For EMF, it looks like I mistakenly overrode those Bootstrap methods -- I missed that PersistenceUnitDescriptor included the CL.  So you're probably right -- presumably you could strip 'em out and somehow use the descriptor, but you might still need the overridden method in HibernatePersistenceProvider so that OsgiPersistenceProvider can give you the OsgiClassLoader to use.

> Additionally, this ClassLoader is ultimately just used to build the
> ClassLoaderService which hibernate-osgi overrides anyway.

Right, assuming you're talking about 'ClassLoaderHelper.overridenClassLoader'.  But the intention there was to remove that whole class ASAP -- that was just a temporary hack for ORM 4, since CL handling was still really static.  But admittedly, I'm a bit out of touch with ORM 5, so I'm not sure if that's feasible yet.

----- Original Message -----
> From: "Steve Ebersole" <steve at hibernate.org>
> To: "hibernate-dev" <hibernate-dev at lists.jboss.org>
> Sent: Saturday, May 23, 2015 1:49:50 PM
> Subject: [hibernate-dev] hibernate-osgi JPA bootstrap & classloader
> 
> Brett,
> 
> As part of HHH-7527 (Enterprise OSGi support) you had changed
> the org.hibernate.jpa.boot.spi.Bootstrap contract to basically overload
> each method to additional accept a "providedClassLoader".
> 
> Every one of those methods however, also accepts
> a org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor which exposes 2
> ClassLoader already.
> 
> Additionally, this ClassLoader is ultimately just used to build the
> ClassLoaderService which hibernate-osgi overrides anyway.
> 
> Just curious if I missed something.  Unless I did, it seems to me that we
> really do not need these overloads on Bootstrap to support Enterprise
> OSGi.  This dove-tails with a discussion from the Karaf user list
> ultimately discussing OsgiClassLoaderService and "holding bundles" that are
> being re-installed or upgraded.  Ultimately I am thinking through ways to
> support being able to release OSGI bundle references from the
> OsgiClassLoaderService...
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 


More information about the hibernate-dev mailing list