title: SingletonEhCacheRegionFactory is no longer available when upgrading from Hibernate 5.2 to 5.3
body: <p>A project I work on is currently using Hibernate version 5.2.15.Final. When configuring the second-level cache, the project has been using <code>org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</code> as the value for <code>hibernate.cache.region.factory_class</code>.</p>
  
  <p>When I change the Hibernate version to 5.3.12.Final, <code>SingletonEhCacheRegionFactory</code> is no longer in that package. A class with that same name is available in the <code>net.sf.ehcache.hibernate</code> package, and I can use that with no compilation errors. But if I run it I get an error when it tries to build a session:</p>
  
  <pre><code>org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]
  
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
      at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl.&lt;init&gt;(MetadataBuilderImpl.java:688)
      at org.hibernate.boot.internal.MetadataBuilderImpl.&lt;init&gt;(MetadataBuilderImpl.java:123)
      at org.hibernate.boot.internal.MetadataBuilderImpl.&lt;init&gt;(MetadataBuilderImpl.java:93)
  </code></pre>
  
  <p>If I dig deeper into the stack trace, the real error seems to be this:</p>
  
  <pre><code>Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]
      at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:133)
      at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:212)
      at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:169)
      at org.hibernate.cache.internal.RegionFactoryInitiator.resolveRegionFactory(RegionFactoryInitiator.java:93)
      at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:47)
      at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:32)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:94)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
      ... 64 more
  Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory]
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:137)
      at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:129)
      ... 71 more
  Caused by: java.lang.NoClassDefFoundError: org/hibernate/cache/QueryResultsRegion
      at java.base/java.lang.Class.forName0(Native Method)
      at java.base/java.lang.Class.forName(Class.java:374)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:131)
      ... 72 more
  Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.QueryResultsRegion
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
      ... 75 more
  </code></pre>
  
  <p>Here's what my pom.xml dependencies look like:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
      &lt;version&gt;5.3.12.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
      &lt;version&gt;5.3.12.Final&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;net.sf.ehcache&lt;/groupId&gt;
      &lt;artifactId&gt;ehcache-core&lt;/artifactId&gt;
      &lt;version&gt;2.6.11&lt;/version&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
      &lt;version&gt;5.3.12.Final&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>