title: Issue with Hibernate EHCache program
body: <p>I am learning how to configure Hibernate with EHCache but facing some issues with it.</p>
  
  <p>I have below details in my `hibernate.cfg.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/hib&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;root&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="hbm2ddl.auto"&gt;create&lt;/property&gt;
          &lt;property name="hibernate.generate_statistics"&gt;true&lt;/property&gt;
          &lt;property name="hibernate.cache.region.factory_class"&gt;org.hibernate.cache.ehcache.EhCacheRegionFactory&lt;/property&gt;
          &lt;property name="net.sf.ehcache.configurationResourceName"&gt;/ehcache.xml&lt;/property&gt;
          &lt;mapping class="cache.three.Department"&gt;&lt;/mapping&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Below is my <code>ehcache.xml</code> file:</p>
  
  <pre><code>&lt;cache
      name="com.examples.domain.Country"
      maxElementsInMemory="10000"
      eternal="false"
      timeToIdleSeconds="300"
      timeToLiveSeconds="600"
      overflowToDisk="true"
  /&gt;
  </code></pre>
  
  <p>I am using <code>Hibernate-4.3.8</code> version. Now when I run my program just to create a SessionFactory using this configuration I am getting below exception:</p>
  
  <pre><code>Initial SessionFactory creation failed.org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
  Exception in thread "main" java.lang.ExceptionInInitializerError
      at example.HibernateUtil.buildSessionFactory(HibernateUtil.java:22)
      at example.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:10)
      at example.MyApp.storeData(MyApp.java:51)
      at example.MyApp.main(MyApp.java:9)
  Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:273)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1930)
      at example.HibernateUtil.buildSessionFactory(HibernateUtil.java:17)
      ... 3 more
  Caused by: org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Error configuring from file:/home/Hibernate/bin/ehcache.xml. Initial cause was Error configuring from input stream. Initial cause was null:8: Element &lt;cache&gt; does not allow attribute "maxElementsInMemory".
      at org.hibernate.cache.ehcache.EhCacheRegionFactory.start(EhCacheRegionFactory.java:107)
      at org.hibernate.internal.CacheImpl.&lt;init&gt;(CacheImpl.java:70)
      at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40)
      at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35)
      at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
      ... 9 more
  </code></pre>
  
  <p>Please tell me know where I am making mistake in this configuration?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Replacing <code>maxElementsInMemory</code> with <code>maxEntriesLocalHeap</code> in ehcache.xml file is throwing below error:</p>
  
  <pre><code>Caused by: org.xml.sax.SAXException: null:8: Element &lt;cache&gt; does not allow attribute "maxEntriesLocalHeap".
  </code></pre>