Spring 4 and Hibernate 5 EhCache no hit L2C -
i have problem ehcache spring , hibernate
my applicationcontext.xml
............... ............... <prop key="hibernate.generate_statistics">true</prop> <!--configuration second level cache using ehcache --> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.ehcacheregionfactory</prop> <prop key="org.hibernate.cache.ehcache.configurationresourcename">/ehcache.xml</prop> .............. ..............
my ehcache.xml under src/main/resources
<?xml version="1.0" encoding="utf-8"?> <ehcache> <diskstore path="java.io.tmpdir" /> <cache name="org.hibernate.cache.internal.standardquerycache" maxelementsinmemory="20" eternal="false" timetoliveseconds="120" overflowtodisk="true" /> <cache name="org.hibernate.cache.spi.updatetimestampscache" maxelementsinmemory="5000" eternal="true" overflowtodisk="true" /> <defaultcache maxelementsinmemory="100" eternal="false" timetoidleseconds="10000" timetoliveseconds="60000" overflowtodisk="false" /> </ehcache>
my entity description
package tr.gov.diski.tender.model; // generated jan 12, 2015 3:07:46 pm hibernate tools 4.3.1 import java.math.bigdecimal; import java.util.calendar; import javax.persistence.cacheable; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.fetchtype; import javax.persistence.joincolumn; import javax.persistence.manytoone; import javax.persistence.table; import javax.persistence.temporal; import javax.persistence.temporaltype; import javax.validation.constraints.size; import org.hibernate.annotations.cache; import org.hibernate.annotations.cacheconcurrencystrategy; import org.hibernate.envers.audited; @entity @table(name = "bond_action") @cache(usage=cacheconcurrencystrategy.read_write) @cacheable @audited public class bondaction extends baseidmodel { private static final long serialversionuid = -5139939632920423389l; public bondaction() { // todo auto-generated constructor stub } @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "ref_bond_payment_type") private bondpaymenttypeprm bondpaymenttypeprm; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "ref_bond_type") private bondtypeprm bondtypeprm; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "ref_ten_comp_action") private tendercompanyaction tendercompanyaction; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "ref_bank_name") private bankprm bankprm; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "ref_bond_from_loc") private bondfromlocation bondfromlocation; @column(name = "bond_price_bank", precision = 15 ,scale=2) private bigdecimal bondpricebank; @temporal(temporaltype.date) @column(name = "bond_start_date") private calendar bondstartdate; @temporal(temporaltype.date) @column(name = "bond_end_date") private calendar bondenddate; @column(name = "from_ext_tender", precision = 2, scale = 0) private byte fromexttender;// fixme @size(max = 25) @column(name = "bond_doc_number") private string bonddocnumber; @column(name = "cash_price", precision = 15 ,scale=2) private bigdecimal cashprice; @size(max = 250) @column(name = "cash_payment_loc") private string cashpaymentloc; @size(max = 500) @column(name = "cash_bill_number") private string cashbillnumber; @size(max = 300) @column(name = "description") private string description; //@getter @setter }
also query , criteria setcacheable(true).but when show statistics ,never hits l2c.please helpme configuration l2c.
statistic output
68130 nanoseconds spent acquiring 1 jdbc connections; 0 nanoseconds spent releasing 0 jdbc connections; 239017 nanoseconds spent preparing 1 jdbc statements; 10621070 nanoseconds spent executing 1 jdbc statements; 0 nanoseconds spent executing 0 jdbc batches; 658277 nanoseconds spent performing 1 l2c puts; 0 nanoseconds spent performing 0 l2c hits; 213359 nanoseconds spent performing 1 l2c misses; 0 nanoseconds spent executing 0 flushes (flushing total of 0 entities , 0 collections); 9963 nanoseconds spent executing 1 partial-flushes (flushing total of 0 entities , 0 collections)
Comments
Post a Comment