Hibernate一级缓存能否被彻底禁用?
- 内容介绍
- 文章标签
- 相关推荐
本文共计245个文字,预计阅读时间需要1分钟。
可以禁用Hibernate一级缓存吗?如果无法禁用,有哪些替代方案?
Canhibernatefirstlevelcachingbedisabled?Incaseitcantbedisabled,arethereanyworkarounCan hibernate first level caching be disabled? Incase it can't be disabled, are there any work arounds?
可以禁用hibernate一级缓存吗?如果它无法禁用,有任何解决方法吗?
1 个解决方案
#1
2
Hibernate first level cache is associated with the Session object. Hibernate first level cache is enabled by default and there is no way to disable it. However hibernate provides methods through which we can delete selected objects from the cache or clear the cache completely. Any object cached in a session will not be visible to other sessions and when the session is closed, all the cached objects will also be lost.
Hibernate第一级缓存与Session对象相关联。默认情况下启用Hibernate第一级缓存,无法禁用它。但是,hibernate提供了一些方法,通过这些方法我们可以从缓存中删除所选对象或完全清除缓存。在会话中缓存的任何对象对其他会话都不可见,并且当会话关闭时,所有缓存的对象也将丢失。
本文共计245个文字,预计阅读时间需要1分钟。
可以禁用Hibernate一级缓存吗?如果无法禁用,有哪些替代方案?
Canhibernatefirstlevelcachingbedisabled?Incaseitcantbedisabled,arethereanyworkarounCan hibernate first level caching be disabled? Incase it can't be disabled, are there any work arounds?
可以禁用hibernate一级缓存吗?如果它无法禁用,有任何解决方法吗?
1 个解决方案
#1
2
Hibernate first level cache is associated with the Session object. Hibernate first level cache is enabled by default and there is no way to disable it. However hibernate provides methods through which we can delete selected objects from the cache or clear the cache completely. Any object cached in a session will not be visible to other sessions and when the session is closed, all the cached objects will also be lost.
Hibernate第一级缓存与Session对象相关联。默认情况下启用Hibernate第一级缓存,无法禁用它。但是,hibernate提供了一些方法,通过这些方法我们可以从缓存中删除所选对象或完全清除缓存。在会话中缓存的任何对象对其他会话都不可见,并且当会话关闭时,所有缓存的对象也将丢失。

