2010-04-20 21:57:38read-only cache configured for mutable class: entity.Classes
2010-04-20 21:57:38Could not find configuration [entity.Classes]; using defaults.
测试过程中出现如上两条信息,但测试结果是正确的。我是边看教学视频边敲代码的,视频上没出现这个问题,我倒出现了,自己搞半天也不知道问题出在哪。
如果说这个 entity.Classes 没找到,那为什么结果会正确呢,我专门改成 entity.Classessss 一运行就直接报错了,说明entity.Classes 这个还是对的。希望有人看懂这个这个问题的能告诉我下,谢谢。
2010-04-20 21:57:38Could not find configuration [entity.Classes]; using defaults.
测试过程中出现如上两条信息,但测试结果是正确的。我是边看教学视频边敲代码的,视频上没出现这个问题,我倒出现了,自己搞半天也不知道问题出在哪。
如果说这个 entity.Classes 没找到,那为什么结果会正确呢,我专门改成 entity.Classessss 一运行就直接报错了,说明entity.Classes 这个还是对的。希望有人看懂这个这个问题的能告诉我下,谢谢。
解决方案 »
- ****servlet服务器端如何向客户端返回数据
- 在线等 当在textarea中插入html标签时如何让效果直接显示出来?
- acegi webservice问题请教
- 如何用 java 打开一个网页 并获取到 页面储存的 cookie 内用?~
- 七哥在这给csdn的朋友拜年了!
- 高分求教:工作流引擎哪个好用?
- 一个spring中配置hibernate问题
- 新手,如何实现日期格式的校验和两个日期的差??????????????
- commons-fileupload上传中文名的文件,处理后的文件名变为乱码?
- EJB的缺点
- 高分求解:用Tomcat6/7 Struts2 spring项目关闭时会memory leak.
- 求JSF下载具体地址
把hbm.xml里的<cache>改成read-write,就像这样:<cache usage="read-write" />
能不在映射文件里改代码吗?
我是在hibernate.cfg.xml文件中添加下面的标签来让我的实体能保存到二级缓存中的。
<class-cache usage="read-only" class="entity.Classes"/>
<class-cache usage="read-write" class="entity.Classes"/>
加上去只少了第一条提示信息
另一条还是出来了
2010-04-20 22:25:09Could not find configuration [entity.Classes]; using defaults.而且我要的就是 usage="read-only"只读 这样不可以吗?
还有为什么改成usage="read-write"第一条提示信息就不会出来呢?
extends CacheManagerEventListenerFactory { @Override
public CacheManagerEventListener createCacheManagerEventListener(
Properties arg0) {
return new EhcacheManagerEventListener();
}}
class EhcacheManagerEventListener implements CacheManagerEventListener { public void notifyCacheAdded(String cacheName) {
System.out.println("Cache [" + cacheName + "] Added");
} public void notifyCacheRemoved(String cacheName) {
System.out.println("Cache [" + cacheName + "] Deleted");
}
}最后日志中报:
WARN - Could not find configuration [com.dp.jdit.community.Issue]; using defaults.
Cache [com.dp.jdit.community.Issue] Added
从日记第一行中看出"没有找到entity.Classes的配置,启用默认配置",
但日记中第二行打印出: Cache [com.dp.jdit.community.Issue] Added, 说明会创建一个com.dp.jdit.community.Issue缓存........怪不???????????????怪不???????????????怪不???????????????怪不???????????????怪不???????????????怪不???????????????
<class ... mutable="false" ...>官方文档说明:
19.2.2. Strategy: read onlyIf your application needs to read but never modify instances of a persistent class, a read-only cache may be used. This is the simplest and best performing strategy. It's even perfectly safe for use in a cluster.<class name="eg.Immutable" mutable="false">
<cache usage="read-only"/>
....
</class>中文解释:
19.2.2. 策略:只读缓存(Strategy: read only)
如果你的应用程序只需读取一个持久化类的实例,而无需对其修改, 那么就可以对其进行只读 缓存。这是最简单,也是实用性最好的方法。甚至在集群中,它也能完美地运作。 <class name="eg.Immutable" mutable="false">
<cache usage="read-only"/>
....
</class>