mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-19 09:35:12 +00:00
HHH-13138 By default, pass the class loader of the test to the EMF
Not doing it causes issues when using the BytecodeEnhancerRunner which introduces an enhancing class loader. We could do it on a per test basis but it's easier to do it once and for all. And it can still be overridden anyway. (cherry picked from commit bae98ffaccf55c78bb1eb39b1e249f9b8ae92726)
This commit is contained in:
parent
d4c47d46f2
commit
bc8bf9a60d
@ -14,6 +14,7 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
@ -21,20 +22,17 @@
|
||||
|
||||
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
||||
import org.hibernate.bytecode.enhance.spi.EnhancementContext;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.jpa.AvailableSettings;
|
||||
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||
import org.hibernate.jpa.boot.spi.Bootstrap;
|
||||
import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* A base class for all ejb tests.
|
||||
*
|
||||
@ -209,6 +207,8 @@ protected Map getConfig() {
|
||||
Map<Object, Object> config = Environment.getProperties();
|
||||
ArrayList<Class> classes = new ArrayList<Class>();
|
||||
|
||||
config.put( AvailableSettings.CLASSLOADERS, getClass().getClassLoader() );
|
||||
|
||||
classes.addAll( Arrays.asList( getAnnotatedClasses() ) );
|
||||
config.put( AvailableSettings.LOADED_CLASSES, classes );
|
||||
for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user