記錄工作,為了遺忘
posts - 22, comments - 17, trackbacks - 0, articles - 15
BlogJava
::
首頁
::
新隨筆
::
聯系
::
聚合
::
管理
spring+ibatis (MySql)操作clob blob
Posted on 2012-07-18 14:45
碼農cz
閱讀(1279)
評論(0)
編輯
收藏
spring+ ibatis 插入clob blob時
在網上找了幾個例子,有點好用,有的報錯
報錯如下:
1.Spring transaction synchronization needs to be active for setting values in iBATIS TypeHandlers that delegate to a Spring LobHandler
2. Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
大體就這兩個
總的說來,就是因為事務的配置問題.
1
<!--
事務管理
-->
2
<
bean
id
="transactionManager2"
class
="org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
3
<
property
name
="dataSource"
ref
="dataSource"
></
property
>
4
</
bean
>
5
6
<!--
聲明式事務管理
-->
7
<
bean
id
="baseTransactionProxy"
class
="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
8
abstract
="true"
>
9
<
property
name
="transactionManager"
ref
="transactionManager2"
></
property
>
10
<
property
name
="transactionAttributes"
>
11
<
props
>
12
<
prop
key
="add*"
>
PROPAGATION_REQUIRED
</
prop
>
13
<
prop
key
="edit*"
>
PROPAGATION_REQUIRED
</
prop
>
14
<
prop
key
="*"
>
r
eadOnly
</
prop
>
15
</
props
>
16
</
property
>
17
</
bean
>
18
19
<
bean
id
="sqlMapClient2"
20
class
="org.springframework.orm.ibatis.SqlMapClientFactoryBean"
>
21
<
property
name
="dataSource"
>
22
<
ref
local
="dataSource"
/>
23
</
property
>
24
<
property
name
="configLocation"
>
25
<
value
>
classpath:SqlMapConfig.xml
</
value
>
26
</
property
>
27
</
bean
>
注意:第14行
如果,你的添加或更新操作不在add*和edit*的范圍內,而你又采用了倒霉的14行配置的時候,你的麻煩就來了......
解決方法有很多,刪掉啊,換成PROPAGETION_REQUIRED啊都可以....推薦第二種吧....
1
<
bean
id
="foodService"
parent
="baseTransactionProxy"
>
2
<
property
name
="target"
>
3
<
bean
class
="com.bigcblob.impl.FoodServiceImpl"
>
4
<
property
ref
="foodDao"
name
="foodDAO"
/>
5
</
bean
>
6
</
property
>
7
</
bean
>
你的服務類如此配置....
額....不管你惡心沒惡心,反正我是惡心了.
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © 碼農cz
日歷
<
2012年7月
>
日
一
二
三
四
五
六
24
25
26
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
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆分類
Android(1)
As u(12)
IntellijIDEA
JavaScript(2)
隨筆檔案
2014年10月 (3)
2012年7月 (4)
2008年5月 (4)
2007年4月 (1)
2007年3月 (1)
2007年1月 (2)
2006年12月 (7)
文章分類
DB----SQL(1)
OtherJava(4)
Spring Around(4)
Spring what I know(2)
文章檔案
2008年6月 (1)
2007年10月 (1)
2006年12月 (13)
搜索
最新評論
1.?re: struts2攔截器概述
I like this,Good!
--peng2e
2.?re: struts2攔截器概述
@wwww
good too
--pirate
3.?re: 有關于Spring攔截器[未登錄]
asd
--dd
4.?re: struts2攔截器概述
good
--wwww
5.?re: struts2攔截器概述
good
--ooo
閱讀排行榜
1.?struts2攔截器概述(6547)
2.?利用Java+POI 讀寫Excel文檔&向Excel中插入圖片(1878)
3.?Struts2 在Action類中獲得HttpServletResponse對象的四種方法(1751)
4.?怎樣動態添加文本框并處理(1434)
5.?tomcat5.5日志(1409)
評論排行榜
1.?struts2攔截器概述(8)
2.?Struts2 在Action類中獲得HttpServletResponse對象的四種方法(3)
3.?利用Java+POI 讀寫Excel文檔&向Excel中插入圖片(2)
4.?怎樣動態添加文本框并處理(1)
5.?Servlet和Filter的url匹配以及url-pattern詳解(0)
主站蜘蛛池模板:
亚洲国产综合精品
|
亚洲色精品vr一区二区三区
|
亚洲国产无线乱码在线观看
|
亚洲AV综合色区无码一二三区
|
4399好看日本在线电影免费
|
亚洲美女激情视频
|
亚州免费一级毛片
|
www亚洲一级视频com
|
亚洲爆乳精品无码一区二区三区
|
亚洲男人都懂得羞羞网站
|
91成人免费福利网站在线
|
亚洲AV永久精品爱情岛论坛
|
今天免费中文字幕视频
|
97久久精品亚洲中文字幕无码
|
久久久久免费精品国产
|
亚洲人成电影在线天堂
|
成人浮力影院免费看
|
中文日韩亚洲欧美制服
|
最新国产乱人伦偷精品免费网站
|
久久亚洲国产午夜精品理论片
|
免费无码又爽又刺激高潮视频
|
欧美亚洲国产SUV
|
99热这里只有精品6免费
|
亚洲av成人综合网
|
国产免费怕怕免费视频观看
|
一个人看的www免费高清
|
中文字幕亚洲免费无线观看日本
|
国产在线观看片a免费观看
|
美女一级毛片免费观看
|
亚洲AV永久纯肉无码精品动漫
|
日韩免费精品视频
|
人妻巨大乳hd免费看
|
亚洲AV成人片色在线观看
|
最近中文字幕mv免费高清视频7
|
亚洲AV无码精品无码麻豆
|
免费看污成人午夜网站
|
丰满少妇作爱视频免费观看
|
久久亚洲AV无码精品色午夜麻豆
|
男女啪啪永久免费观看网站
|
国产免费A∨在线播放
|
亚洲国产熟亚洲女视频
|