我有一个项目,该项目在带有OraclDB和WebLogic应用程序服务器的DataAccessLayer中使用了JPA和Hibernate。另外,我提供了second-level-cache
至ehcache
的以下配置:
ehcache.xml
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache>
maxEntriesLocalHeap="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
maxEntriesLocalDisk="10000000"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"/>
<persistence strategy="localTempSwap"
</defaultCache>
</ehcache>
persistence.xml
<persistence-unit name="datasource1" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>my_datasource</jta-data-source>
<class>...</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<!--add this config for weblogic-->
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region.factory_class"
value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>
</properties>
</persistence-unit>
和我在 pom.xml 中的依赖项:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.2.0.Final</version>
</dependency>
我的问题:
我们需要在我们的项目中提供一个集群系统。
与我们的业务一样,我们保留会话(某种程度上是有状态的),因此我们希望启用ehcache复制技术以在群集的所有节点中提供会话。
启用ehcache replication
的配置是什么?