HHH-8160 Support unmanaged JPA in 4.3.x
This commit is contained in:
parent
73891e06d5
commit
06bb009dc6
|
@ -40,6 +40,7 @@ import java.util.ServiceLoader;
|
|||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.internal.util.ClassLoaderHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
|
@ -137,7 +138,7 @@ public class ClassLoaderServiceImpl implements ClassLoaderService {
|
|||
|
||||
private static ClassLoader locateTCCL() {
|
||||
try {
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
return ClassLoaderHelper.getContextClassLoader();
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
return null;
|
||||
|
|
|
@ -66,6 +66,9 @@ public class OsgiPersistenceProvider extends HibernatePersistenceProvider {
|
|||
// TODO: This needs tested.
|
||||
properties.put( org.hibernate.jpa.AvailableSettings.SCANNER,
|
||||
new OsgiScanner( requestingBundle ) );
|
||||
// TODO: This is temporary -- for PersistenceXmlParser's use of
|
||||
// ClassLoaderServiceImpl#fromConfigSettings
|
||||
properties.put( AvailableSettings.ENVIRONMENT_CLASSLOADER, osgiClassLoader );
|
||||
|
||||
osgiClassLoader.addBundle( requestingBundle );
|
||||
|
||||
|
|
Loading…
Reference in New Issue