开发者

hibernate don't read from ehcache.xml OR not timeout?

This is how my entity look like

@Entity
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)   

@Table(name = "TestPojoOnly")
@NamedQueries({@NamedQuery(name = "TestPojoOnly.findAll", query = "SELECT h FROM TestPojoOnly h"), @NamedQuery(name = "TestPojoOnly.findB开发者_C百科yId", query = "SELECT h FROM TestPojoOnly h WHERE h.id = :id"), @NamedQuery(name = "TestPojoOnly.findByCategoryname", query = "SELECT h FROM TestPojoOnly h WHERE h.categoryname = :categoryname")})
public class TestPojoOnly implements Serializable {

my ehcache.xml

<cache name="com.package.model.TestPojoOnly"
    maxElementsInMemory="200"
    eternal="false"
    overflowToDisk="false"
    timeToIdleSeconds="0"
    timeToLiveSeconds="0"
/>

Q. I already set time to Zero and eternal to false, but when i try load entity from db. it still get from cache. time=0 that mean no cache right? did i miss out something?

ref: my appcontex.xml at http://www.copypastecode.com/16833/


timeToIdleSeconds and timeToLiveSeconds both treat zero as infinity. It wouldn't cut and paste properly from my iPhone, but if you do a find on the the ehcache configuration doc here for timeToLiveSeconds it says "A value of 0 means that an Element can live for infinity."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜