本月博客排行
年度博客排行
-
第1名
青否云后端云 -
第2名
zw7534313 -
第3名
大家都说我很棒 - liyihz2008
- wy_19921005
- gengyun12
- hbxflihua
- e_e
- luxurioust
- dbagirl
- zysnba
- robotmen
- Alsmile
- gaozzsoft
- jywhltj
- cpongo1
- leslie26
- qepwqnp
- 解宜然
- cuityang
- sichunli_030
- gashero
- zhangdaiscott
- fantaxy025025
- vipbooks
- wallimn
- gdpglc
- ssydxa219
- ranbuijj
- javashop
- jickcai
- hanbaohong
- johnsmith9th
- appalese
- gaojingsong
- weiyides
- 淡看人生
- java-007
- zhangyi0618
- AVI
- laiyangdeli
- xpenxpen
- liunancun
- 龙哥IT
- conkeyn
- nychen2000
- lyndon.lin
- ouanui
- silverend
- jveqi
最新文章列表
Hibernate事务并发处理相关总结
1.事务的ACID特性。
Atomic原子性 Consistency一致性 Isolation隔离型 Durability持久性
2.事务并发时可能出现的问题
(1)dirty read——脏读,读取了其他事务还没有提交的数据。
(2)non-repeatable read——不可以重复读,指在一个事务进行过程中,另外一个事务更新了数据,导致该事物对同一条记录的读取前后 ...
hibernate事务
Session session=null;
try{
session=factory.openSession();
//开启事务
session.beginTransaction();
User user = new User();
user.setName("张三");
user.setPassword("123");
...
Hibernate事务
事务并发时可能出现的问题
主要的几点
1.脏读dirty read 主要指读了另外一个事物没有提交的数据
2.不可重复读non-repetable 在同一个事务中,对同一个数据读的值是不一样的
3.幻读phantom-read 主要是在插入和删除的时候出现的问题,一个事物在读的时候,另一个事务插入了一条数据,影响了第一个事务
数据库的事务隔离机制
1.read-uncommitted 会出 ...
Spring 中自带的事务管理
Spring 集成 hibernate 的事务管理,不用我们手动开启和提交事务了:
需要在xml文件头部的 xsi:schemaLocation 添加:
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
hibernate 配置文件中可设的 ...