【发布时间】:2010-12-23 02:21:34
【问题描述】:
这就是我的实体的样子
@Entity
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "TestPojoOnly")
@NamedQueries({@NamedQuery(name = "TestPojoOnly.findAll", query = "SELECT h FROM TestPojoOnly h"), @NamedQuery(name = "TestPojoOnly.findById", 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 {
我的 ehcache.xml
<cache name="com.package.model.TestPojoOnly"
maxElementsInMemory="200"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
/>
问。我已经将时间设置为零并将永恒设置为假,但是当我尝试从 db.load 加载实体时。它仍然从缓存中获取。 time=0 表示没有缓存对吗?我错过了什么吗?
参考:我的 appcontex.xml 在http://www.copypastecode.com/16833/
【问题讨论】:
标签: java hibernate spring ehcache