城市獵人
在一網(wǎng)情深的日子里,誰能說得清是苦是甜,只知道確定了就義無反顧
posts - 1, comments - 7, trackbacks - 0, articles - 89
導航
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
<
2025年7月
>
日
一
二
三
四
五
六
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
8
9
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(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)
網(wǎng)絡筆試題集(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之靜態(tài)代理和動態(tài)代理
@AloneAli不好意思,弄錯了。代理模式是種模式。。。不是裝飾者模式。
--AloneAli
2.?re: AOP之靜態(tài)代理和動態(tài)代理
實質(zhì)就是裝飾者模式?
--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
閱讀(395)
評論(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
<!--
定義事務管理器,使用適用于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后處理器,根據(jù)事務攔截器為目標bean自動創(chuàng)建事務代理
-->
77
<
bean
78
class
="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"
>
79
<!--
指定對滿足哪些bean name的bean自動生成業(yè)務代理
-->
80
<
property
name
="beanNames"
>
81
<!--
下面是所有需要自動創(chuàng)建事務代理的bean
-->
82
<
list
>
83
<
value
>
employeeService
</
value
>
84
</
list
>
85
<!--
此處可增加其他需要自動創(chuàng)建事務代理的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
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
AOP之靜態(tài)代理和動態(tài)代理
spring 生命式事務管理配置
spring aop總結(jié)
Spring事務配置的五種方式
配置Spring的方法(轉(zhuǎn))
Powered by:
BlogJava
Copyright © sailor
主站蜘蛛池模板:
免费A级毛片无码A
|
91精品国产免费网站
|
亚洲AV无码专区亚洲AV桃
|
极品色天使在线婷婷天堂亚洲
|
成人影片一区免费观看
|
免费看h片的网站
|
免费一级e一片在线播放
|
久久精品国产亚洲av瑜伽
|
在线观看91精品国产不卡免费
|
中文字幕第一页亚洲
|
亚洲天堂一区在线
|
老外毛片免费视频播放
|
91av视频免费在线观看
|
久久亚洲sm情趣捆绑调教
|
亚洲人成www在线播放
|
一级毛片a免费播放王色
|
97在线视频免费公开观看
|
亚洲高清无在码在线电影不卡
|
亚洲精品视频免费在线观看
|
国产亚洲自拍一区
|
久久免费国产精品一区二区
|
国产精品免费一级在线观看
|
亚洲欧洲视频在线观看
|
黄桃AV无码免费一区二区三区
|
亚洲精品无码成人片在线观看
|
欧美最猛性xxxxx免费
|
国产亚洲精品xxx
|
边摸边吃奶边做爽免费视频网站
|
亚洲国产成人精品女人久久久
|
国产大片91精品免费看3
|
国产精品免费久久久久久久久
|
午夜成人免费视频
|
免费国产成人午夜私人影视
|
久久99精品免费一区二区
|
日日夜夜精品免费视频
|
一区二区视频免费观看
|
亚洲精品影院久久久久久
|
国产精品麻豆免费版
|
日本免费高清视频
|
亚洲成在人线av
|
丁香花在线观看免费观看图片
|