城市獵人
在一網(wǎng)情深的日子里,誰能說得清是苦是甜,只知道確定了就義無反顧
posts - 1, comments - 7, trackbacks - 0, articles - 89
導(dǎo)航
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
<
2025年5月
>
日
一
二
三
四
五
六
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
常用鏈接
我的隨筆
我的文章
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(3)
給我留言
查看公開留言
查看私人留言
文章分類
(90)
AJAX-DWR/EXT/JQUERY(1)
EJB3(5)
Glassfish(2)
Hibernate(1)
ibatis(2)
java(12)
javascript(4)
linux(3)
mysql(1)
oracle(28)
others
PowerDesigner(1)
Solaris(2)
spring(5)
struts(2)
struts2(2)
weblogic(1)
分錄(2)
心得體會(huì)(1)
模式(12)
網(wǎng)絡(luò)筆試題集(1)
錯(cuò)誤集(1)
錘煉(1)
文章檔案
(90)
2012年8月 (1)
2011年12月 (1)
2011年11月 (1)
2011年8月 (2)
2011年3月 (1)
2010年6月 (1)
2009年9月 (1)
2009年8月 (4)
2009年7月 (2)
2009年6月 (1)
2009年4月 (5)
2009年3月 (3)
2009年1月 (2)
2008年12月 (8)
2008年11月 (5)
2008年10月 (7)
2008年9月 (3)
2008年8月 (6)
2008年7月 (33)
2008年5月 (3)
收藏夾
(12)
Ext
Hibernate
Ibatis(2)
J2EE(1)
J2SE(4)
Jquery
Mysql
Oracle(1)
Spring
strtus
Struts2(3)
Weblogic
下載地址(1)
設(shè)計(jì)模式
軟件工程
搜索
最新評(píng)論
1.?re: AOP之靜態(tài)代理和動(dòng)態(tài)代理
@AloneAli不好意思,弄錯(cuò)了。代理模式是種模式。。。不是裝飾者模式。
--AloneAli
2.?re: AOP之靜態(tài)代理和動(dòng)態(tài)代理
實(shí)質(zhì)就是裝飾者模式?
--AloneAli
3.?re: struts與jquery整合[未登錄]
學(xué)習(xí)下!
--力
4.?re: struts與jquery整合
很好,很強(qiáng)大,謝謝了
--f
5.?re: struts與jquery整合
thanks
--ami
spring 生命式事務(wù)管理配置
Posted on 2009-04-29 18:31
sailor
閱讀(391)
評(píng)論(0)
編輯
收藏
所屬分類:
spring
1、hibernate.properties
1
hibernate.dialect=org.hibernate.dialect.MySQLDialect
2
hibernate.driverClassName=com.mysql.jdbc.Driver
3
hibernate.url=jdbc:mysql://127.0.0.1:3306/test
4
hibernate.username=root
5
hibernate.password=sa
6
hibernate.showSQL=true
7
hibernate.maxActive=50
8
hibernate.maxIdle=30
9
hibernate.maxWait=1000
2、applicationContext.xml
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<
beans
3
xmlns
="http://www.springframework.org/schema/beans"
4
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
5
xsi:schemaLocation
="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
>
6
7
<!--
讀入屬性文件
-->
8
<
bean
id
="propertyConfig"
class
="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
9
<
property
name
="locations"
>
10
<
list
>
11
<
value
>
classpath:hibernate.properties
</
value
>
12
</
list
>
13
</
property
>
14
</
bean
>
15
16
<!--
配置數(shù)據(jù)源,可以其他方式
-->
17
<
bean
id
="dataSource"
class
="org.apache.commons.dbcp.BasicDataSource"
>
18
<
property
name
="driverClassName"
value
="${hibernate.driverClassName}"
/>
19
<
property
name
="url"
value
="${hibernate.url}"
/>
20
<
property
name
="username"
value
="${hibernate.username}"
/>
21
<
property
name
="password"
value
="${hibernate.password}"
/>
22
<
property
name
="maxActive"
value
="${hibernate.maxActive}"
/>
23
<
property
name
="maxIdle"
value
="${hibernate.maxIdle}"
/>
24
<
property
name
="maxWait"
value
="${hibernate.maxWait}"
/>
25
</
bean
>
26
27
<!--
配置Hibernate的Session工廠,注入數(shù)據(jù)源、映射文件
-->
28
<
bean
id
="sessionFactory"
class
="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
>
29
<
property
name
="dataSource"
>
30
<
ref
local
="dataSource"
/>
31
</
property
>
32
<
property
name
="mappingResources"
>
33
<
list
>
34
<
value
>
com/sailor/test/dao/Employee.hbm.xml
</
value
>
35
</
list
>
36
</
property
>
37
<
property
name
="hibernateProperties"
>
38
<
props
>
39
<
prop
key
="hibernate.dialect"
>
${hibernate.dialect}
</
prop
>
40
<
prop
key
="hibernate.show_sql"
>
${hibernate.showSQL}
</
prop
>
41
</
props
>
42
</
property
>
43
</
bean
>
44
45
46
<!--
定義事務(wù)管理器,使用適用于Hibernte的事務(wù)管理器
-->
47
<
bean
id
="transactionManager"
48
class
="org.springframework.orm.hibernate3.HibernateTransactionManager"
>
49
<!--
HibernateTransactionManager bean需要依賴注入一個(gè)SessionFactory bean的引用
-->
50
<
property
name
="sessionFactory"
>
51
<
ref
local
="sessionFactory"
/>
52
</
property
>
53
</
bean
>
54
55
<!--
配置事務(wù)攔截器
-->
56
<
bean
id
="transactionInterceptor"
57
class
="org.springframework.transaction.interceptor.TransactionInterceptor"
>
58
<!--
事務(wù)攔截器bean需要依賴注入一個(gè)事務(wù)管理器
-->
59
<
property
name
="transactionManager"
ref
="transactionManager"
/>
60
<
property
name
="transactionAttributes"
>
61
<!--
下面定義事務(wù)傳播屬性
-->
62
<
props
>
63
<!--
所有以save開頭的方法,采用required的事務(wù)策略
-->
64
<
prop
key
="save*"
>
PROPAGATION_REQUIRED
</
prop
>
65
<!--
所有以mod開頭的方法,采用required的事務(wù)策略
-->
66
<
prop
key
="mod*"
>
PROPAGATION_REQUIRED
</
prop
>
67
<!--
所有以del開頭的方法,采用required的事務(wù)策略
-->
68
<
prop
key
="del*"
>
PROPAGATION_REQUIRED
</
prop
>
69
<!--
其他方法,readOnly
-->
70
<
prop
key
="*"
>
readOnly
</
prop
>
71
</
props
>
72
</
property
>
73
</
bean
>
74
75
<!--
定義BeanNameAutoProxyCreator,該bean是個(gè)bean后處理器,無需被引用,因此沒有id屬性
76
這個(gè)bean后處理器,根據(jù)事務(wù)攔截器為目標(biāo)bean自動(dòng)創(chuàng)建事務(wù)代理
-->
77
<
bean
78
class
="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"
>
79
<!--
指定對(duì)滿足哪些bean name的bean自動(dòng)生成業(yè)務(wù)代理
-->
80
<
property
name
="beanNames"
>
81
<!--
下面是所有需要自動(dòng)創(chuàng)建事務(wù)代理的bean
-->
82
<
list
>
83
<
value
>
employeeService
</
value
>
84
</
list
>
85
<!--
此處可增加其他需要自動(dòng)創(chuàng)建事務(wù)代理的bean
-->
86
</
property
>
87
<!--
下面定義BeanNameAutoProxyCreator所需的事務(wù)攔截器
-->
88
<
property
name
="interceptorNames"
>
89
<
list
>
90
<
value
>
transactionInterceptor
</
value
>
91
<!--
此處可增加其他新的Interceptor
-->
92
</
list
>
93
</
property
>
94
</
bean
>
95
96
<!--
dao層
-->
97
<
bean
id
="employeeDAO"
class
="com.sailor.test.dao.EmployeeDAO"
>
98
<
property
name
="sessionFactory"
ref
="sessionFactory"
></
property
>
99
</
bean
>
100
101
<!--
service層
-->
102
<
bean
id
="employeeService"
class
="com.sailor.test.service.impl.EmployeeServiceImpl"
>
103
<
property
name
="employeeDAO"
ref
="employeeDAO"
/>
104
</
bean
>
105
106
</
beans
>
源代碼:
/Files/sailor/spring_hibernate_transaction1.rar
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
AOP之靜態(tài)代理和動(dòng)態(tài)代理
spring 生命式事務(wù)管理配置
spring aop總結(jié)
Spring事務(wù)配置的五種方式
配置Spring的方法(轉(zhuǎn))
Powered by:
BlogJava
Copyright © sailor
主站蜘蛛池模板:
2022年亚洲午夜一区二区福利
|
男人的天堂网免费网站
|
亚洲黄色网址大全
|
亚洲区小说区图片区
|
在线免费不卡视频
|
黄在线观看www免费看
|
99re6在线精品免费观看
|
无码一区二区三区亚洲人妻
|
亚洲中文字幕无码av在线
|
亚洲AV日韩AV永久无码免下载
|
亚洲无码视频在线
|
国产免费AV片无码永久免费
|
四虎永久在线精品免费网址
|
日本免费网址大全在线观看
|
国产一级a毛一级a看免费视频
|
99re热免费精品视频观看
|
污视频网站免费在线观看
|
亚洲va乱码一区二区三区
|
亚洲综合精品香蕉久久网97
|
国产亚洲精久久久久久无码77777 国产亚洲精品成人AA片新蒲金
|
亚洲人成色777777精品
|
亚洲欧洲高清有无
|
免费国产不卡午夜福在线
|
久久精品无码一区二区三区免费
|
57pao一国产成永久免费
|
人人狠狠综合久久亚洲88
|
亚洲精品国产精品乱码不卡
|
国产性生交xxxxx免费
|
永久免费看bbb
|
色妞WWW精品免费视频
|
一二三四在线播放免费观看中文版视频
|
亚洲乱码中文字幕在线
|
中国china体内裑精亚洲日本
|
亚洲人成色7777在线观看不卡
|
国产免费私拍一区二区三区
|
免费毛片在线视频
|
国产精品高清全国免费观看
|
mm1313亚洲国产精品美女
|
亚洲AV无码之日韩精品
|
亚洲高清最新av网站
|
久久亚洲国产精品123区
|