Hi All,
I have configured 2nd level caching through JPA and Hibernate guidelines. The setup seems to be working, as I see query results being cached and also following warnigns while deploying the jar file. May I know the reason for showing these warnings? How can I fix these warnings? It seems that the ehcache.xml configs are not picked up for non defaults.
**************************************
14:02:08,753 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
14:02:08,815 WARN [AbstractEhcacheProvider] Could not find a specific ehcache configuration for cache named [persistence.unit:unitName=TestCacheEJB.jar/#TestCache.test.SysSecureElementProfileEntity]; using defaults.
14:02:08,846 WARN [AbstractEhcacheProvider] Could not find a specific ehcache configuration for cache named [persistence.unit:unitName=TestCacheEJB.jar/#TestCache.org.hibernate.cache.UpdateTimestampsCache]; using defaults.
14:02:08,846 WARN [AbstractEhcacheProvider] Could not find a specific ehcache configuration for cache named [persistence.unit:unitName=TestCacheEJB.jar/#TestCache.org.hibernate.cache.StandardQueryCache]; using defaults.
******************************************
Here are configurations....
persistence.xml:-
============
<?xml version="1.0" encoding="UTF-8"?>
<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/ ... ce_1_0.xsd"
version="1.0">
<persistence-unit name="TestCache" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/xxxxx</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.show_sql" value="true" />
<!--
<property name="hibernate.query.factory_class" value="org.hibernate.hql.ast.ASTQueryTranslatorFactory" />
-->
<property name="hibernate.generate_statistics" value="false" />
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider" />
<property name="hibernate.cache.provider_configuration_file_resource_path" value="/ehcache.xml"/>
<property name="hibernate.ejb.classcache.test.SysSecureElementProfileEntity" value="read-write, test.SysSecureElementProfileEntity"/>
</properties>
</persistence-unit>
</persistence>
ehcache.xml :
==========
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
overflowToDisk="false"
diskPersistent="false"
timeToLiveSeconds="1800"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache
name="persistence.unit:unitName=TestCacheEJB.jar/#TestCache.test.SysSecureElementProfileEntity" maxElementsInMemory="100" eternal="false" timeToLiveSeconds="1800" overflowToDisk="false" />
<cache
name="test.SysSecureElementProfileEntity" maxElementsInMemory="100" eternal="false" timeToLiveSeconds="1800" overflowToDisk="false" />
<cache
name="org.hibernate.cache.StandardQueryCache"
eternal="false"
timeToLiveSeconds="120"
overflowToDisk="true"/>
<cache
name="org.hibernate.cache.UpdateTimestampsCache"
eternal="true"
overflowToDisk="true"/>
</ehcache>