Alpha
多少春秋風雨改 多少崎嶇不變愛
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆-179 評論-666 文章-29 trackbacks-0
Spring+Hibernate的配制
1.applicationContext.xml 文件的配制:
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"
>
3
4
<
beans
>
5
6
<
bean
id
="dataSource"
class
="org.apache.commons.dbcp.BasicDataSource"
destroy-method
="close"
>
7
8
<
property
name
="driverClassName"
>
9
<
value
>
com.mysql.jdbc.Driver
</
value
>
10
</
property
>
11
12
<
property
name
="url"
>
13
<
value
>
jdbc:mysql://192.168.2.186/task
</
value
>
14
</
property
>
15
16
<
property
name
="username"
>
17
<
value
>
task
</
value
>
18
</
property
>
19
20
<
property
name
="password"
>
21
<
value
>
123
</
value
>
22
</
property
>
23
</
bean
>
24
25
<
bean
id
="sessionFactory"
class
="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
singleton
="true"
>
26
27
<
property
name
="dataSource"
>
28
<
ref
local
="dataSource"
/>
29
</
property
>
30
31
<
property
name
="mappingResources"
>
32
<
list
>
33
<
value
>
com/task/hibernatemap/xml/UserInfo.hbm.xml
</
value
>
34
<
value
>
com/task/hibernatemap/xml/Apply.hbm.xml
</
value
>
35
<
value
>
com/task/hibernatemap/xml/Approve.hbm.xml
</
value
>
36
<
value
>
com/task/hibernatemap/xml/Discription.hbm.xml
</
value
>
37
<
value
>
com/task/hibernatemap/xml/Person.hbm.xml
</
value
>
38
<
value
>
com/task/hibernatemap/xml/ItemName.hbm.xml
</
value
>
39
<
value
>
com/task/hibernatemap/xml/ItemVersion.hbm.xml
</
value
>
40
</
list
>
41
</
property
>
42
43
<
property
name
="hibernateProperties"
>
44
<
props
>
45
<
prop
key
="hibernate.dialect"
>
org.hibernate.dialect.MySQLDialect
</
prop
>
46
<
prop
key
="hibernate.show_sql"
>
false
</
prop
>
47
</
props
>
48
</
property
>
49
</
bean
>
50
51
<
bean
id
="transactionManager"
class
="org.springframework.orm.hibernate3.HibernateTransactionManager"
>
52
<
property
name
="sessionFactory"
>
53
<
ref
local
="sessionFactory"
/>
54
</
property
>
55
</
bean
>
56
57
<
bean
id
="hibernateDao"
class
="com.task.common.HibernateDao"
>
58
<
property
name
="sessionFactory"
>
59
<
ref
local
="sessionFactory"
/>
60
</
property
>
61
<
property
name
="transactionManager"
>
62
<
ref
local
="transactionManager"
/>
63
</
property
>
64
</
bean
>
65
66
<
bean
id
="hibernateDaoProxy"
singleton
="true"
class
="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
>
67
<
property
name
="transactionManager"
>
68
<
ref
bean
="transactionManager"
/>
69
</
property
>
70
71
<
property
name
="target"
>
72
<
ref
local
="hibernateDao"
/>
73
</
property
>
74
75
<
property
name
="transactionAttributes"
>
76
<
props
>
77
<
prop
key
="save*"
>
PROPAGATION_REQUIRED
</
prop
>
78
<
prop
key
="remove*"
>
PROPAGATION_REQUIRED
</
prop
>
79
<
prop
key
="update*"
>
PROPAGATION_REQUIRED
</
prop
>
80
<
prop
key
="*"
>
PROPAGATION_REQUIRED,readOnly
</
prop
>
81
</
props
>
82
</
property
>
83
</
bean
>
84
85
</
beans
>
86
2.web.xml 文件的配制:
1
<?
xml version="1.0" encoding="ISO-8859-1"
?>
2
3
<!
DOCTYPE web-app
4
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
5
"http://java.sun.com/dtd/web-app_2_3.dtd"
>
6
7
<
web-app
>
8
9
<
filter
>
10
<
filter-name
>
openSessionInViewFilter
</
filter-name
>
11
<
filter-class
>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</
filter-class
>
12
</
filter
>
13
<
filter-mapping
>
14
<
filter-name
>
openSessionInViewFilter
</
filter-name
>
15
<
url-pattern
>
/*
</
url-pattern
>
16
</
filter-mapping
>
17
18
<
listener
>
19
<
listener-class
>
org.springframework.web.context.ContextLoaderListener
</
listener-class
>
20
</
listener
>
21
22
23
<
servlet
>
24
<
servlet-name
>
task
</
servlet-name
>
25
<
servlet-class
>
org.springframework.web.servlet.DispatcherServlet
</
servlet-class
>
26
<
load-on-startup
>
1
</
load-on-startup
>
27
</
servlet
>
28
29
<
servlet-mapping
>
30
<
servlet-name
>
task
</
servlet-name
>
31
<
url-pattern
>
*.job
</
url-pattern
>
32
</
servlet-mapping
>
33
34
<
welcome-file-list
>
35
<
welcome-file
>
index.jsp
</
welcome-file
>
36
</
welcome-file-list
>
37
</
web-app
>
3.
task
-servlet.xml 文件的配制:
1
<?
xml version="1.0" encoding="UTF-8"
?>
2
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"
>
3
4
<
beans
>
5
6
<
bean
id
="listController"
class
="com.task.controller.ListController"
>
7
<
property
name
="defaultPage"
><
value
>
/list
</
value
></
property
>
8
</
bean
>
9
10
11
<
bean
id
="urlMapping"
class
="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"
>
12
<
property
name
="mappings"
>
13
<
props
>
14
<
prop
key
="/list*"
>
listController
</
prop
>
15
</
props
>
16
</
property
>
17
</
bean
>
18
19
<
bean
id
="viewResolver"
class
="org.springframework.web.servlet.view.InternalResourceViewResolver"
>
20
<
property
name
="viewClass"
>
21
<
value
>
org.springframework.web.servlet.view.JstlView
</
value
>
22
</
property
>
23
<
property
name
="suffix"
><
value
>
.jsp
</
value
></
property
>
24
</
bean
>
25
26
</
beans
>
27
需要注意的是,第三個文件的文件名一定要與第二個文件中黃色字體名字一樣!
posted on 2006-02-10 09:54
Alpha
閱讀(1328)
評論(3)
編輯
收藏
所屬分類:
Spring
評論:
#
re: Spring+Hibernate的配制 2006-02-13 12:34 |
Jet Geng
好東西。mappingResources這個屬性我找了很久了。呵呵。
謝謝了
回復
更多評論
#
re: Spring+Hibernate的配制 2006-03-16 11:39 |
liuzhiwen
明顯就是橙色,華哥,你不行啊
回復
更多評論
#
re: Spring+Hibernate的配制[未登錄]
2010-05-22 09:20 |
aa
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
回復
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
使用Spring MVC表單標簽
【轉載】Spring入門
Spring+Hibernate的配制
今日記一事,明日悟一理,積久而成學。
<
2006年2月
>
日
一
二
三
四
五
六
29
30
31
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
1
2
3
4
5
6
7
8
9
10
11
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(32)
給我留言
查看公開留言
查看私人留言
隨筆分類
(182)
Android 移動開發
Hibernate(2)
Java J2EE JSP(31)
jQuery JavaScript Flex(5)
Linux Nginx(28)
MySQL NoSQL(14)
PHP ThinkPHP(2)
SEO優化 網站推廣(1)
Spring(3)
吳語輪筆(81)
吾亦好攝(8)
開源開發工具使用(2)
網站設計 用戶體驗(5)
文章分類
(39)
J2EE+JSP(1)
JavaScript(9)
Linux、操作系統(9)
人生哲理(4)
多愁善感(11)
憤青集中營(2)
數據庫SQL(3)
相冊
06圣誕節
07.1.7水濂山
07年元旦
原創圖片
雜七雜八
校慶
梅花
友情鏈接
VIP卡云
壞男孩
田逸blog
黎波
我的地盤
技術文檔
CSS 樣式表參考文檔
DHTML 參考手冊
DWR中文文檔
MySQL 5.1參考手冊
Spring Framework 開發參考手冊
灰狐文檔中心
搜索
積分與排名
積分 - 1330095
排名 - 20
最新隨筆
1.?Centos7安裝Nginx+PHP+MySQL
2.?Ubuntu完美安裝搭建Git服務器
3.?Git本地服務器搭建及使用詳解
4.?Linux 常見運維命令
5.?Linux怎樣恢復誤刪除的數據
6.? CentOS 7 安裝 Nginx、PHP7、PHP-FPM
7.?Tomcat8 安全配置與性能優化
8.?Ubuntu14.04下部署FastDFS 5.08+Nginx 1.9.14
9.?Ubuntu14.04下搭建VPN服務
10.?CentOS 6.4 配置VPN服務教程
最新評論
1.?re: Ubuntu14.04下部署FastDFS 5.08+Nginx 1.9.14
相當成功
--reatang
2.?re: mysql alter 語句用法,添加、修改、刪除字段等
密密麻麻嗎
--,,,
3.?eettafellamp
評論內容較長,點擊標題查看
--eettafellamp
4.?re: 使用Spring MVC表單標簽
水電費
-- 低調
5.?aanrechtblad
評論內容較長,點擊標題查看
--aanrechtblad
6.?re: Tomcat8 安全配置與性能優化[未登錄]
評論內容較長,點擊標題查看
--aa
7.?re: Tomcat8 安全配置與性能優化[未登錄]
評論內容較長,點擊標題查看
--aa
8.?aa[未登錄]
啊啊啊啊
--aa
9.?re: Ubuntu14.04下部署FastDFS 5.08+Nginx 1.9.14
可以可以可以
--司馬青衫
10.?re: mysql alter 語句用法,添加、修改、刪除字段等[未登錄]
1111
--a
閱讀排行榜
1.?MySQL的mysqldump工具的基本用法(237568)
2.?mysql alter 語句用法,添加、修改、刪除字段等(166857)
3.?HttpClient 學習整理(143515)
4.?c3p0詳細配置(91822)
5.?Mysql日期和時間函數大全(61379)
6.?Hibernate 不同數據庫的連接及SQL方言(50281)
7.?iptables 開啟80端口 (32157)
8.?AS與JS相互通信(Flex中調用js函數)(26666)
9.?使用Spring MVC表單標簽(23983)
10.?JFreeChart在JSP中的應用實例(22543)
11.?scrollbar屬性、樣式詳解(20577)
12.?linux+nginx+tomcat負載均衡,實現session同步(20433)
13.?多級反向代理[Squid]下獲取客戶端真實IP地址(16394)
14.?linux rsync同步設置詳細指南(15691)
15.?jsp頁面中,JSTL El表達式字符串比較常用方法(15588)
評論排行榜
1.?南雄中學百年校慶(91)
2.?HttpClient 學習整理(44)
3.?JFreeChart在JSP中的應用實例(29)
4.?c3p0詳細配置(26)
5.?從MySQL得到最大的性能(20)
6.?學會如何去愛一個人(16)
7.?千年珠璣(15)
8.?笑翻天樂園-痛并快樂著(14)
9.?說說我們技術部(13)
10.?MySQL的mysqldump工具的基本用法(12)
11.?述 職 報 告(11)
12.?多級反向代理[Squid]下獲取客戶端真實IP地址(11)
13.?雙喜臨門(10)
14.?元旦遭遇人山人海(9)
15.?一個身材超好的MM(7)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 Alpha
主站蜘蛛池模板:
鲁大师在线影院免费观看
|
日本高清不卡aⅴ免费网站
|
毛色毛片免费观看
|
亚洲卡一卡2卡三卡4麻豆
|
最近中文字幕完整免费视频ww
|
亚洲狠狠爱综合影院婷婷
|
理论亚洲区美一区二区三区
|
午夜一级免费视频
|
真人无码作爱免费视频
|
亚洲中文字幕无码专区
|
a级午夜毛片免费一区二区
|
亚洲国产成人精品不卡青青草原
|
无码A级毛片免费视频内谢
|
亚洲综合图片小说区热久久
|
免免费国产AAAAA片
|
亚洲熟妇无码AV不卡在线播放
|
永久免费看bbb
|
一级毛片免费全部播放
|
国产精品亚洲аv无码播放
|
57pao国产成视频免费播放
|
国产精品亚洲专区在线观看
|
国产精品免费电影
|
中文字幕永久免费
|
亚洲日本在线播放
|
国产一级特黄高清免费大片
|
成人毛片100免费观看
|
亚洲日韩区在线电影
|
女性自慰aⅴ片高清免费
|
色www永久免费视频
|
麻豆一区二区三区蜜桃免费
|
最新亚洲成av人免费看
|
午夜理伦剧场免费
|
亚洲欧美日韩中文字幕在线一区
|
jiz zz在亚洲
|
亚洲一区二区三区在线播放
|
精品女同一区二区三区免费站
|
亚洲AV无码一区二区三区牲色
|
日韩亚洲欧洲在线com91tv
|
天天天欲色欲色WWW免费
|
中国黄色免费网站
|
亚洲熟妇无码一区二区三区
|