城市獵人
在一網情深的日子里,誰能說得清是苦是甜,只知道確定了就義無反顧
posts - 1, comments - 7, trackbacks - 0, articles - 89
導航
BlogJava
首頁
新隨筆
聯系
聚合
管理
<
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
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(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)
心得體會(1)
模式(12)
網絡筆試題集(1)
錯誤集(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)
設計模式
軟件工程
搜索
最新評論
1.?re: AOP之靜態代理和動態代理
@AloneAli不好意思,弄錯了。代理模式是種模式。。。不是裝飾者模式。
--AloneAli
2.?re: AOP之靜態代理和動態代理
實質就是裝飾者模式?
--AloneAli
3.?re: struts與jquery整合[未登錄]
學習下!
--力
4.?re: struts與jquery整合
很好,很強大,謝謝了
--f
5.?re: struts與jquery整合
thanks
--ami
spring 生命式事務管理配置
Posted on 2009-04-29 18:31
sailor
閱讀(391)
評論(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
<!--
配置數據源,可以其他方式
-->
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工廠,注入數據源、映射文件
-->
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
<!--
定義事務管理器,使用適用于Hibernte的事務管理器
-->
47
<
bean
id
="transactionManager"
48
class
="org.springframework.orm.hibernate3.HibernateTransactionManager"
>
49
<!--
HibernateTransactionManager bean需要依賴注入一個SessionFactory bean的引用
-->
50
<
property
name
="sessionFactory"
>
51
<
ref
local
="sessionFactory"
/>
52
</
property
>
53
</
bean
>
54
55
<!--
配置事務攔截器
-->
56
<
bean
id
="transactionInterceptor"
57
class
="org.springframework.transaction.interceptor.TransactionInterceptor"
>
58
<!--
事務攔截器bean需要依賴注入一個事務管理器
-->
59
<
property
name
="transactionManager"
ref
="transactionManager"
/>
60
<
property
name
="transactionAttributes"
>
61
<!--
下面定義事務傳播屬性
-->
62
<
props
>
63
<!--
所有以save開頭的方法,采用required的事務策略
-->
64
<
prop
key
="save*"
>
PROPAGATION_REQUIRED
</
prop
>
65
<!--
所有以mod開頭的方法,采用required的事務策略
-->
66
<
prop
key
="mod*"
>
PROPAGATION_REQUIRED
</
prop
>
67
<!--
所有以del開頭的方法,采用required的事務策略
-->
68
<
prop
key
="del*"
>
PROPAGATION_REQUIRED
</
prop
>
69
<!--
其他方法,readOnly
-->
70
<
prop
key
="*"
>
readOnly
</
prop
>
71
</
props
>
72
</
property
>
73
</
bean
>
74
75
<!--
定義BeanNameAutoProxyCreator,該bean是個bean后處理器,無需被引用,因此沒有id屬性
76
這個bean后處理器,根據事務攔截器為目標bean自動創建事務代理
-->
77
<
bean
78
class
="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"
>
79
<!--
指定對滿足哪些bean name的bean自動生成業務代理
-->
80
<
property
name
="beanNames"
>
81
<!--
下面是所有需要自動創建事務代理的bean
-->
82
<
list
>
83
<
value
>
employeeService
</
value
>
84
</
list
>
85
<!--
此處可增加其他需要自動創建事務代理的bean
-->
86
</
property
>
87
<!--
下面定義BeanNameAutoProxyCreator所需的事務攔截器
-->
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
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
AOP之靜態代理和動態代理
spring 生命式事務管理配置
spring aop總結
Spring事務配置的五種方式
配置Spring的方法(轉)
Powered by:
BlogJava
Copyright © sailor
主站蜘蛛池模板:
久久精品免费全国观看国产
|
污污免费在线观看
|
色欲色香天天天综合网站免费
|
亚洲国产一区二区视频网站
|
免费精品国自产拍在线播放
|
四虎影视免费永久在线观看
|
亚洲成人免费在线观看
|
精品亚洲一区二区
|
一级毛片**不卡免费播
|
亚洲视频一区在线播放
|
100000免费啪啪18免进
|
亚洲熟妇成人精品一区
|
日本xxwwxxww在线视频免费
|
日韩一区二区三区免费播放
|
国产成人精品久久亚洲
|
99蜜桃在线观看免费视频网站
|
亚洲成色999久久网站
|
波多野结衣免费在线
|
久久精品国产亚洲av天美18
|
亚洲综合国产精品第一页
|
大地资源中文在线观看免费版
|
久久精品a亚洲国产v高清不卡
|
100000免费啪啪18免进
|
香港经典a毛片免费观看看
|
亚洲一区二区三区偷拍女厕
|
337p日本欧洲亚洲大胆人人
|
免费A级毛片无码A
|
免费的全黄一级录像带
|
亚洲激情视频图片
|
亚洲国产黄在线观看
|
亚洲视频在线免费播放
|
瑟瑟网站免费网站入口
|
久久精品国产亚洲77777
|
国产精品嫩草影院免费
|
久久免费视频观看
|
亚洲av午夜电影在线观看
|
亚洲国产精品无码专区影院
|
国产人在线成免费视频
|
99re6在线视频精品免费
|
国产精品亚洲片夜色在线
|
亚洲精品无码AV中文字幕电影网站
|