- 浏览: 1284007 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
-
最后的攻城狮:
这也太乱了
mybatis与spring事物处理日志 -
leo_soul:
现在不能跨1级域名了吧?比如www.aaa.com,www.b ...
Cookie跨域操作 -
zy976133:
怎么解决的
jaxws不支持SOAPBinding.Use.ENCODED -
cuiyaoqiang:
你好 开发一个http接口给fs调用 ,这个http接口是自己 ...
freeswitch 动态加载号码 -
Jackromer:
请问楼主知道如何通过主控方来删除与其有关的中间表记录? 谢谢, ...
hibernate 多对多只删除中间表数据
今天查看hibernate cache接口时 svn了hibernate3.3的源码
打开CacheProvider类一看 居然给 @deprecated
真是大块人心
早就对hibernate的二级缓存和查询缓存不爽
只能按照实体配置 不能针对某条查询语句设置
3.3的提供了两个接口 Region RegionFactory 来代替 3.2中的Cache CacheProvider
看看RegionFactory 的实现吧
看看这几个方法名字是多么的让人激动
英文不好 猜测的 英文好的可以翻译一下
在gg上搜索了一下hibernate RegionFactory 关键字 居然没搜索到
难道大家对个功能都不感冒
附上hibernate3.3 cache包里的说明
早就对hibernate的二级缓存和查询缓存不爽
只能按照实体配置 不能针对某条查询语句设置
Query一致就允许setCacheRegion...
应该会清除所有缓存吧
可以去看看源码
为什么不是来维护数据类
比如说修改好了然后接着进行二级缓存的维护,读取最新的数据
应该会清除所有缓存吧
可以去看看源码
打开CacheProvider类一看 居然给 @deprecated
真是大块人心
早就对hibernate的二级缓存和查询缓存不爽
只能按照实体配置 不能针对某条查询语句设置
3.3的提供了两个接口 Region RegionFactory 来代替 3.2中的Cache CacheProvider
看看RegionFactory 的实现吧
看看这几个方法名字是多么的让人激动
buildCollectionRegion 对集合的缓存 猜测是对一对多的集合进行配置的吧 buildQueryResultsRegion 查询缓存 自定义的查询 也可以有自己的region了 buildTimestampsRegion 给缓存设置过期时间吧
英文不好 猜测的 英文好的可以翻译一下
在gg上搜索了一下hibernate RegionFactory 关键字 居然没搜索到
难道大家对个功能都不感冒
public interface RegionFactory { public void start(Settings settings, Properties properties) throws CacheException; public void stop(); public boolean isMinimalPutsEnabledByDefault(); public long nextTimestamp(); public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException; public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException; public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException; public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException; }
附上hibernate3.3 cache包里的说明
引用
This package defines APIs/SPIs and implementations for the Hibernate second-level cache.
The legacy (and now deprecated) approach to caching is defined by the {@link org.hibernate.cache.CacheProvider} and {@link org.hibernate.cache.Cache} interfaces as well as the {@link org.hibernate.cache.CacheConcurrencyStrategy} interface along with the various implementations of all these interfaces. In that scheme, a {@link org.hibernate.cache.CacheProvider} defined how to configure and perform lifecycle operations in regards to a particular underlying caching library; it also defined how to build {@link org.hibernate.cache.Cache} instances which in turn defined how to access the "regions" of the underlying cache instance. For entity and collection data cache regions, {@link org.hibernate.cache.CacheConcurrencyStrategy} wrapped access to those cache regions to apply transactional/concurrent access semantics.
The improved approach is based on {@link org.hibernate.cache.RegionFactory}, the various {@link org.hibernate.cache.Region} specializations and the two access strategies contracts ({@link org.hibernate.cache.access.EntityRegionAccessStrategy} and {@link org.hibernate.cache.access.CollectionRegionAccessStrategy}). The general approach here is that {@link org.hibernate.cache.RegionFactory} defined how to configure and perform lifecycle operations in regards to a particular underlying caching library (or libraries). {@link org.hibernate.cache.RegionFactory} also defines how to build specialized {@link org.hibernate.cache.Region} instances based on the type of data we will be storing in that given region. The fact that {@link org.hibernate.cache.RegionFactory} is asked to build specialized regions (as opposed to just general access) is the first improvement over the legacy scheme. The second improvement is the fact that the regions (well the ones like entity and collection regions that are responsible for storing {@link org.hibernate.cache.TransactionalDataRegion transactional} data) are asked to build their own access strategies (see {@link org.hibernate.cache.EntityRegion#buildAccessStrategy} and {@link org.hibernate.cache.CollectionRegion#buildAccessStrategy}).
The legacy (and now deprecated) approach to caching is defined by the {@link org.hibernate.cache.CacheProvider} and {@link org.hibernate.cache.Cache} interfaces as well as the {@link org.hibernate.cache.CacheConcurrencyStrategy} interface along with the various implementations of all these interfaces. In that scheme, a {@link org.hibernate.cache.CacheProvider} defined how to configure and perform lifecycle operations in regards to a particular underlying caching library; it also defined how to build {@link org.hibernate.cache.Cache} instances which in turn defined how to access the "regions" of the underlying cache instance. For entity and collection data cache regions, {@link org.hibernate.cache.CacheConcurrencyStrategy} wrapped access to those cache regions to apply transactional/concurrent access semantics.
The improved approach is based on {@link org.hibernate.cache.RegionFactory}, the various {@link org.hibernate.cache.Region} specializations and the two access strategies contracts ({@link org.hibernate.cache.access.EntityRegionAccessStrategy} and {@link org.hibernate.cache.access.CollectionRegionAccessStrategy}). The general approach here is that {@link org.hibernate.cache.RegionFactory} defined how to configure and perform lifecycle operations in regards to a particular underlying caching library (or libraries). {@link org.hibernate.cache.RegionFactory} also defines how to build specialized {@link org.hibernate.cache.Region} instances based on the type of data we will be storing in that given region. The fact that {@link org.hibernate.cache.RegionFactory} is asked to build specialized regions (as opposed to just general access) is the first improvement over the legacy scheme. The second improvement is the fact that the regions (well the ones like entity and collection regions that are responsible for storing {@link org.hibernate.cache.TransactionalDataRegion transactional} data) are asked to build their own access strategies (see {@link org.hibernate.cache.EntityRegion#buildAccessStrategy} and {@link org.hibernate.cache.CollectionRegion#buildAccessStrategy}).
评论
12 楼
hantsy
2009-03-09
二级缓存方法只在频繁读取而极少更新(甚至没有更新)的情况下有用。。。
如果是频繁更新的操作,使用它的话,只会降低性能。
如果是频繁更新的操作,使用它的话,只会降低性能。
11 楼
kjj
2009-01-11
呵呵,希望楼主再接再厉,搞出一个instance 来 ,直接把原来的3.X 升级成3.3
10 楼
flyheh
2008-12-24
能对查询和记录进行缓存,真是有点激动人心,谢谢LZ共享
9 楼
e4077wf
2008-12-23
郁闷我怎么看不明白了; 楼主的那一个张学友的照片很帅 !
8 楼
nihongye
2008-12-23
xly_971223 写道
早就对hibernate的二级缓存和查询缓存不爽
只能按照实体配置 不能针对某条查询语句设置
Query一致就允许setCacheRegion...
7 楼
darkjune
2008-12-23
还没有机会看源码这一块的
6 楼
srdrm
2008-11-30
恩,确实对二级缓存做了改进。原有的接口只是个简单的应急,这次估计也只能算是个过渡。不过应该是比原来的好点了吧,有机会再好好研究下源码
5 楼
raymond2006k
2008-11-26
新东东,新气象。
看其接口和实现,表现形式上的确有很大变化,不过其思想和以前的 CacheProvider + Cache还是一样的。
看其接口和实现,表现形式上的确有很大变化,不过其思想和以前的 CacheProvider + Cache还是一样的。
4 楼
mosheo
2008-11-26
xly_971223 写道
ququzone 写道
hibernate3.3使用HQL做批量更新时二级缓存做不做响应的更新?
应该会清除所有缓存吧
可以去看看源码
为什么不是来维护数据类
比如说修改好了然后接着进行二级缓存的维护,读取最新的数据
3 楼
xly_971223
2008-11-25
ququzone 写道
hibernate3.3使用HQL做批量更新时二级缓存做不做响应的更新?
应该会清除所有缓存吧
可以去看看源码
2 楼
xly_971223
2008-11-25
public interface GeneralDataRegion extends Region { /** * Get an item from the cache. * * @param key The key of the item to be retrieved. * @return the cached object or <tt>null</tt> * @throws CacheException Indicates a problem accessing the item or region. */ public Object get(Object key) throws CacheException; /** * Put an item into the cache. * * @param key The key under which to cache the item. * @param value The item to cache. * @throws CacheException Indicates a problem accessing the region. */ public void put(Object key, Object value) throws CacheException; /** * Evict an item from the cache immediately (without regard for transaction * isolation). * * @param key The key of the item to remove * @throws CacheException Indicates a problem accessing the item or region. */ public void evict(Object key) throws CacheException; /** * Evict all contents of this particular cache region (without regard for transaction * isolation). * * @throws CacheException Indicates problem accessing the region. */ public void evictAll() throws CacheException; }
1 楼
ququzone
2008-11-25
hibernate3.3使用HQL做批量更新时二级缓存做不做响应的更新?
发表评论
-
多线程模式之Future Pattern
2013-06-24 17:22 1243Future模式在jdk5中有实现 其特点是:不阻塞等待函数的 ... -
多线程模式之Thread per message
2013-06-20 14:00 1222Thread per Message 意思是每个请求都启动一个 ... -
多线程之读写锁模式 Read-Write Lock Pattern
2013-06-08 16:37 3019场景: 老师在黑板上写了字,很多学生在下面读 现在老师要擦掉 ... -
java Thread只interrupted() interrupt() isInterrupted()
2013-06-07 15:22 3736Thread类有几个与中断有关的方法 Thread.inte ... -
多线程之Producer-Consumer Pattern
2013-06-07 13:24 2005生产者/消费者模式 有两个厨师在做蛋糕(生产者)两个客人在吃蛋 ... -
多线程模式之 Guarded Suspension Pattern
2013-06-04 18:00 1492Guarded Suspension Pattern这个模式翻 ... -
java synchronize 与 lock
2013-05-30 15:55 1219synchronize方法和 synchronized 块都不 ... -
java wait notifyAll方法
2013-05-29 14:02 1473说道java多线程就不能不提synchronize wait ... -
java的抽象方法是如何实现的
2010-11-09 16:39 2115C++编译器如何处理虚函数 C++中的虚函数就是java中的 ... -
JVM内存结构
2010-07-20 15:06 1731把知道的java内存结构简单缕一缕 主要有这个几个 方法区 ... -
不用任何框架开发web service
2010-07-19 17:20 2698很讨厌webservice框架配置的繁琐 尤其是axis系列 ... -
List与数组占用字节数
2010-07-17 19:03 4681想看一下List序列化后占用多少个 字节,测试程序如下: p ... -
java CAS原语
2010-07-10 17:18 7630java 中的synchronized关键字是悲观锁 也叫独占 ... -
理解CountDownLatch
2010-07-10 11:11 2113字面意思是倒计时类 类名其实说的很形象,倒数到0时线程解除阻塞 ... -
xmemcached
2010-07-02 08:47 3602package net.rubyeye.xmemcached. ... -
hibernate search 手动创建索引
2010-06-04 14:55 4237hibernate search默认采用自动创建索引 只要在e ... -
正则表达式中的groupCount与group
2010-03-15 11:58 12815groupCount是用在pattern中有‘()’时使用 如 ... -
eclipse中svn合并
2010-03-12 10:09 5627概述 本文介绍了在eclipse中合并svn项目 主干 分支 ... -
java发送http head请求
2010-02-25 10:58 10935public static void main(String ... -
nio ByteBuffer理解
2010-02-24 10:57 2418ByteBuffer实际上是一块连续的内容 可以理解成一个by ...
相关推荐
此项目整合了目前主流和最前源的web开发技术:采用ehcache实现二级缓存(包含查询缓存);用sf4j及logback(log4j的升级版)记录日志;proxool(据说是dbcp和c3p0三者中最优秀的)做连接池;使用jquery的ajax实现仿...
同时,它改进了性能和缓存策略,增强了查询语言HQL(Hibernate Query Language)的功能,提供了更强大的数据检索能力。 在整合这三个框架时,通常会采用Spring作为应用的容器,管理Struts2和Hibernate的实例。...
在Hibernate 3.3版之后,推荐使用基于RegionFactory的缓存机制,而不是基于CacheProvider的老方法。然而,对于旧版本的理解仍然是选择合适缓存策略的基础。 总之,Hibernate的缓存机制通过减少数据库访问频率,提升...
22.4 管理Hibernate的第二级缓存 22.4.1 配置进程范围内的第二级缓存 22.4.2 配置集群范围内的第二级缓存 22.4.3 在应用程序中管理第二级缓存 22.4.4 Session与第二级缓存的交互模式 22.5 运行本章的...
为了提高应用程序性能,Hibernate 内置了缓存机制,分为一级缓存和二级缓存。 - **一级缓存**:默认启用,用于 Session 内部,当 Session 关闭时清空。 - **二级缓存**:可选配置,用于不同 Session 间共享数据,可...
MVC4引入了若干新特性,如移动支持、改进的模板选择机制、新的路由库等,使得开发者可以更加灵活地构建应用。 NHibernate是.NET平台上的一款开源ORM框架,它允许开发人员用面向对象的方式处理数据库操作,而无需...
缓存能够存放的最大元素数量是一个重要的参数,当缓存达到最大容量时,需要采用缓存更新策略进行数据的替换或清理。 **1.5 缓存更新策略** - **1.5.1 FIFO (First In First Out)**:最早进入缓存的数据将在缓存...
3. 配置Hibernate属性,如缓存策略、方言等; 4. 注册实体类。 ##### 3.4 配置事务 事务管理是持久层开发中的一个重要方面。Spring提供了一种简单的方式来进行事务管理,即使用`TransactionManager`。 配置事务的...
22.4 管理Hibernate的第二级缓存 22.4.1 配置进程范围内的第二级缓存 22.4.2 配置集群范围内的第二级缓存 22.4.3 在应用程序中管理第二级缓存 22.4.4 Session与第二级缓存的交互模式 22.5 运行本章的...
22.4 管理Hibernate的第二级缓存 22.4.1 配置进程范围内的第二级缓存 22.4.2 配置集群范围内的第二级缓存 22.4.3 在应用程序中管理第二级缓存 22.4.4 Session与第二级缓存的交互模式 22.5 运行本章的...
22.4 管理Hibernate的第二级缓存 22.4.1 配置进程范围内的第二级缓存 22.4.2 配置集群范围内的第二级缓存 22.4.3 在应用程序中管理第二级缓存 22.4.4 Session与第二级缓存的交互模式 22.5 运行本章的...
- **模块化设计**:Hibernate采用了模块化的架构设计,便于扩展和维护。 - **JMX集成**:提供了对Java管理扩展的支持,便于监控和管理Hibernate实例。 - **JCA支持**:通过资源适配器提供与企业级应用服务器的集成。...
此外,Hibernate还支持二级缓存,提高了数据访问效率。 Spring2.5.6是Spring框架的一个经典版本,它强化了依赖注入,使得对象的创建和配置更加灵活,降低了组件之间的耦合。同时,Spring2.5.6加强了AOP支持,可以...
舍得网采用基于Hibernate的高效数据库缓存系统,该系统集成了Memcached的分布式特性,成功支撑起日均1亿PV的访问量。通过精细的设计和实现,不仅保证了系统的稳定性和性能,还大幅降低了数据库的压力。 - **技术...
- **自定义缓存提供者**:可以使用第三方缓存实现(如 Ehcache)作为 Hibernate 的二级缓存。 - **事务策略配置**:配置 Hibernate 如何处理事务边界。 - **JNDI 绑定 SessionFactory**:在容器环境中,可以将 ...
下载最新的Hibernate版本,本课程推荐使用版本3.3。 - **集成环境**: - 创建Java项目。 - 添加必要的jar包:将`hibernate3.jar`和`lib/required`目录下的所有jar包添加到项目中,并确保包含了数据库驱动的jar包。...
通过配置文件如`hibernate.properties`等,开发者可以灵活地设置Hibernate的行为,如缓存策略、连接池管理等。 #### 四、结论 综上所述,HSS技术在电子政务系统中的应用具有明显的优势,不仅可以提高系统的整体...