mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
HHH-8160 Support unmanaged JPA in 4.3.x
This commit is contained in:
parent
73891e06d5
commit
06bb009dc6
@ -40,6 +40,7 @@
|
||||
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 @@ private static ClassLoader locateSystemClassLoader() {
|
||||
|
||||
private static ClassLoader locateTCCL() {
|
||||
try {
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
return ClassLoaderHelper.getContextClassLoader();
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
return null;
|
||||
|
@ -66,6 +66,9 @@ public EntityManagerFactory createEntityManagerFactory(String persistenceUnitNam
|
||||
// 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…
x
Reference in New Issue
Block a user