|
23 | 23 | import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
|
24 | 24 | import org.hibernate.boot.model.relational.Database;
|
25 | 25 | import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
26 |
| -import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder; |
27 | 26 | import org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl;
|
| 27 | +import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; |
28 | 28 | import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
| 29 | +import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl; |
29 | 30 | import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
| 31 | +import org.hibernate.boot.registry.selector.internal.StrategySelectorImpl; |
30 | 32 | import org.hibernate.boot.spi.BootstrapContext;
|
31 | 33 | import org.hibernate.boot.spi.MappingDefaults;
|
32 | 34 | import org.hibernate.boot.spi.MetadataBuildingContext;
|
@@ -161,25 +163,31 @@ public abstract class MockSessionFactory
|
161 | 163 | private final MetadataContext metadataContext;
|
162 | 164 |
|
163 | 165 | public MockSessionFactory() {
|
164 |
| - |
165 |
| - serviceRegistry = StandardServiceRegistryImpl.create( |
166 |
| - new BootstrapServiceRegistryBuilder().applyClassLoaderService(new ClassLoaderServiceImpl() { |
167 |
| - @Override |
168 |
| - @SuppressWarnings("unchecked") |
169 |
| - public Class<?> classForName(String className) { |
170 |
| - try { |
171 |
| - return super.classForName(className); |
172 |
| - } |
173 |
| - catch (ClassLoadingException e) { |
174 |
| - if (isClassDefined(className)) { |
175 |
| - return Object[].class; |
176 |
| - } |
177 |
| - else { |
178 |
| - throw e; |
179 |
| - } |
180 |
| - } |
| 166 | + final ClassLoaderService classLoaderService = new ClassLoaderServiceImpl() { |
| 167 | + @Override |
| 168 | + @SuppressWarnings("unchecked") |
| 169 | + public Class<?> classForName(String className) { |
| 170 | + try { |
| 171 | + return super.classForName( className ); |
| 172 | + } |
| 173 | + catch (ClassLoadingException e) { |
| 174 | + if ( isClassDefined( className ) ) { |
| 175 | + return Object[].class; |
| 176 | + } |
| 177 | + else { |
| 178 | + throw e; |
181 | 179 | }
|
182 |
| - }).build(), |
| 180 | + } |
| 181 | + } |
| 182 | + }; |
| 183 | + serviceRegistry = StandardServiceRegistryImpl.create( |
| 184 | + new BootstrapServiceRegistryImpl( |
| 185 | + true, |
| 186 | + classLoaderService, |
| 187 | + new StrategySelectorImpl( classLoaderService ), |
| 188 | + () -> emptyList() |
| 189 | + ), |
| 190 | +// new BootstrapServiceRegistryBuilder().applyClassLoaderService( classLoaderService ).build(), |
183 | 191 | singletonList(MockJdbcServicesInitiator.INSTANCE),
|
184 | 192 | emptyList(),
|
185 | 193 | emptyMap()
|
|
0 commit comments