在使用Hibernate4,ehcache 2.6时,对实体类进行缓存,
实体类配置如下:
<class name="com.test.model.Info" table="info">
<cache usage="read-write"/> many-to-one 配置: <many-to-one name="type" class="com.test.model.Type"
column="type_id" lazy="false" insert="false" update="false" not-found="ignore"/> ehcache.xml配置如下:
<cache name="com.test.model.Info" maxEntriesLocalHeap="100"
eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false" />
在列表页读取One中的数据,对新添加的Info,第二次刷新列表,One的属性为Null。 是哪里不对吗?hibernateehcache
实体类配置如下:
<class name="com.test.model.Info" table="info">
<cache usage="read-write"/> many-to-one 配置: <many-to-one name="type" class="com.test.model.Type"
column="type_id" lazy="false" insert="false" update="false" not-found="ignore"/> ehcache.xml配置如下:
<cache name="com.test.model.Info" maxEntriesLocalHeap="100"
eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false" />
在列表页读取One中的数据,对新添加的Info,第二次刷新列表,One的属性为Null。 是哪里不对吗?hibernateehcache
我纳闷的是,在我重启Tomcat之后,直接点列表,one是有数据的,我在many那边新加一条记录,返回到列表,这时新加的那条one也是有数据,此时刷新一下列表后,新加的那条的one已经为null了,而其他原来的数据还是有的,不解。