HHH-8160 Support unmanaged JPA in 4.3.x

This commit is contained in:
Brett Meyer 2013-04-08 19:38:07 -04:00
parent 73891e06d5
commit 06bb009dc6
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -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 );