Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating EhCache from native implementation to Hibernate implementation
    primarykey
    data
    text
    <p>My project uses Spring 3.x, Hibernate 4.2.7, JPA and Maven. It was migrated from a 3.x Hibernate version. Previously, the project used the following package:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;net.sf.ehcache&lt;/groupId&gt; &lt;artifactId&gt;ehcache&lt;/artifactId&gt; &lt;version&gt;2.3.1&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>I found out that Hibernate has its own implementation from EhCache, so I updated my package configuration like this:</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;4.2.7.Final&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt; &lt;version&gt;4.2.7.Final&lt;/version&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;4.2.7.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;4.2.7.Final&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>Worked fine, but now I have a problem: how to specify my <code>ehcache.xml</code> previous declaration? My actual <code>persistence.xml</code> looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"&gt; &lt;persistence-unit name="consultlog"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;properties&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt; &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt; &lt;property name="hibernate.show_sql" value="false" /&gt; &lt;property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory" /&gt; &lt;property name="net.sf.ehcache.configurationResourceName"&gt;/ehcache.xml&lt;/property&gt; &lt;property name="hibernate.cache.use_second_level_cache" value="true" /&gt; &lt;property name="hibernate.cache.use_query_cache" value="true" /&gt; &lt;property name="default_batch_fetch_size" value="5" /&gt; &lt;property name="hibernate.connection.driver_class" value="org.postgresql.Driver" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:postgresql://localhost/mydatabase" /&gt; &lt;property name="hibernate.connection.username" value="myuser" /&gt; &lt;property name="hibernate.connection.password" value="mypassword" /&gt; &lt;property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" /&gt; &lt;property name="hibernate.c3p0.max_size" value="80" /&gt; &lt;property name="hibernate.c3p0.min_size" value="0" /&gt; &lt;property name="hibernate.c3p0.acquire_increment" value="1" /&gt; &lt;property name="hibernate.c3p0.idle_test_period" value="300" /&gt; &lt;property name="hibernate.c3p0.max_statements" value="0" /&gt; &lt;property name="hibernate.c3p0.timeout" value="100" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; </code></pre> <p></p> <p>How I have to replace this line?</p> <pre><code>&lt;property name="net.sf.ehcache.configurationResourceName"&gt;/ehcache.xml&lt;/property&gt; </code></pre> <p>Or even better, how I can use <code>persistence.xml</code> to perform the configuration?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload