2012年6月26日

hibernate 悲观锁与乐观锁

摘要: 锁(locking)业务逻辑的实现过程中,往往需要保证数据访问的排他性。如在金融系统的日终结算处理中,我们希望针对某个cut-off时间点的数据进行处理,而不希望在结算进行过程中(可能是几秒种,也可能是几个小时),数据再发生变化。此时,我们就需要通过一些机制来保证这些数据在某个操作过程中不会被外界修改,这样的机制,在这里,也就是所谓的“锁”,即给我们选定的目标数据上锁,使其无法被其他程序修改。Hibernate支持两种锁机制:即通常所说的“悲观锁(Pessimistic Locking)”和“乐观锁(Optimistic Locking)”。悲观锁(Pessimistic Locking)悲观 阅读全文

posted @ 2012-06-26 18:55 陈惟鲜的博客 阅读(143) 评论(0) 推荐(0) 编辑

oracle union 跟union all ,exists跟in

摘要: 在sql 中据说使用,exists 效率高于in,那么exists 跟in等价的sql如下,aa跟bb表关联字段user_idselect * from aa where aa.user_id not in (select bb.user_id from bb);select * from aa where not exists(select bb.user_id from bb where bb.user_id=aa.user_id);select * from aa where aa.user_id in (select bb.user_id from bb);select * from 阅读全文

posted @ 2012-06-26 18:54 陈惟鲜的博客 阅读(284) 评论(0) 推荐(0) 编辑

apache2.2 + tomcat 6 集群

摘要: APACHE 2.2.8+TOMCAT6.0.14配置负载均衡目标: 使用 apache 和 tomcat 配置一个可以应用的 web 网站,要达到以下要求: 1、 Apache 做为 HttpServer ,后面连接多个 tomcat 应用实例,并进行负载均衡。 2、 为系统设定 Session 超时时间,包括 Apache 和 tomcat 3、 为系统屏蔽文件列表,包括 Apache 和 tomcat 注:本例程以一台机器为例子,即同一台机器上装一个apache和4个Tomcat。一、前期准备工作:安装用的程序(前提保证已安装了JDK1.5以上的版本)APAHCE 2.2.8下载:apa 阅读全文

posted @ 2012-06-26 18:53 陈惟鲜的博客 阅读(194) 评论(0) 推荐(0) 编辑

导航