Skip to content

Commit 06bb009

Browse files
committed
HHH-8160 Support unmanaged JPA in 4.3.x
1 parent 73891e0 commit 06bb009

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
4141
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
4242
import org.hibernate.cfg.AvailableSettings;
43+
import org.hibernate.internal.util.ClassLoaderHelper;
4344
import org.jboss.logging.Logger;
4445

4546
/**
@@ -137,7 +138,7 @@ private static ClassLoader locateSystemClassLoader() {
137138

138139
private static ClassLoader locateTCCL() {
139140
try {
140-
return Thread.currentThread().getContextClassLoader();
141+
return ClassLoaderHelper.getContextClassLoader();
141142
}
142143
catch ( Exception e ) {
143144
return null;

hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiPersistenceProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public EntityManagerFactory createEntityManagerFactory(String persistenceUnitNam
6666
// TODO: This needs tested.
6767
properties.put( org.hibernate.jpa.AvailableSettings.SCANNER,
6868
new OsgiScanner( requestingBundle ) );
69+
// TODO: This is temporary -- for PersistenceXmlParser's use of
70+
// ClassLoaderServiceImpl#fromConfigSettings
71+
properties.put( AvailableSettings.ENVIRONMENT_CLASSLOADER, osgiClassLoader );
6972

7073
osgiClassLoader.addBundle( requestingBundle );
7174

0 commit comments

Comments
 (0)