java - Not able to configure JPA with ehcache -


i have been trying configure jpa ehcache no success till now. configurations doing :

  • persistence.xml

    <persistence-unit name="customdatabase">   <jta-data-source>jdbc/oraclexe_ds</jta-data-source>   <class>com.td.waw.cse.entities.product</class>   <properties>                    <property name="openjpa.log" value="defaultlevel=trace, runtime=info, tool=info, sql=trace"/>            <property name="openjpa.querycache" value="net.sf.ehcache.openjpa.datacache.ehcachequerycache"/>    <property name="openjpa.datacachemanager" value="net.sf.ehcache.openjpa.datacache.ehcachedatacachemanager"/>    <property name="openjpa.datacache" value="net.sf.ehcache.openjpa.datacache.ehcachedatacache"/>    <property name="openjpa.remotecommitprovider" value="net.sf.ehcache.openjpa.datacache.noopremotecommitprovider"/> </properties> 
  • ehcache.xml

    <ehcache xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"          xsi:nonamespaceschemalocation="ehcache.xsd"          updatecheck="true" monitoring="autodetect"          dynamicconfig="true" >     <defaultcache     maxelementsinmemory="1000"     eternal="false"     timetoidleseconds="300"     timetoliveseconds="600"     overflowtodisk="false"     memorystoreevictionpolicy="lru"     />      <!-- openjpa data cache -->     <cache name="openjpa"     maxelementsinmemory="5000"     eternal="false"     timetoidleseconds="300"     timetoliveseconds="600"     overflowtodisk="false"     memorystoreevictionpolicy="lru"     />      <!-- openjpa query cache -->     <cache name="openjpa-querycache"     maxelementsinmemory="1000"     eternal="false"     timetoidleseconds="300"     timetoliveseconds="600"     overflowtodisk="false"     memorystoreevictionpolicy="lru"     /> </ehcache> 
  • product.java

    @entity @table(name="product") @namedqueries({@namedquery(name="getallproducts", query = "select products product products")}) public class product implements serializable {} 

i not getting exception not see ehcache working nothing specific ehcache printed in logs. appreciate if can in this.

add following properties in persistence.xml:

<property name="openjpa.querycache" value="ehcache"/> <property name="openjpa.datacachemanager" value="ehcache"/> 

add following jars in classpath:ehcache-core-2.4.4.jar, ehcache-openjpa-0.2.0.jar , slf4j-api-1.6.1.jar.

that's all.

jar downloads:

references


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -