記錄工作,為了遺忘
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)
主站蜘蛛池模板:
亚洲av综合avav中文
|
久久久久亚洲AV成人无码
|
亚洲欧洲AV无码专区
|
久久亚洲精品无码网站
|
色妞WWW精品免费视频
|
亚洲色一区二区三区四区
|
女人张开腿等男人桶免费视频
|
亚洲乱码中文论理电影
|
国产99久久亚洲综合精品
|
国产午夜无码精品免费看
|
中文字幕无码免费久久99
|
亚洲成av人片不卡无码久久
|
久久久久久a亚洲欧洲AV
|
91精品全国免费观看含羞草
|
亚洲高清美女一区二区三区
|
97国产免费全部免费观看
|
亚洲综合一区国产精品
|
国产免费拔擦拔擦8x
|
成在人线av无码免费高潮水
|
久久亚洲精品中文字幕三区
|
足恋玩丝袜脚视频免费网站
|
亚洲综合中文字幕无线码
|
久久免费精彩视频
|
亚洲制服丝袜中文字幕
|
免费人成在线观看视频播放
|
亚洲日本国产综合高清
|
免费永久看黄在线观看app
|
三级网站免费观看
|
亚洲大香伊人蕉在人依线
|
国产免费观看视频
|
免费观看成人久久网免费观看
|
亚洲国产成人精品无码区在线网站
|
成人午夜视频免费
|
一区二区三区在线免费观看视频
|
亚洲国产精品国自产拍AV
|
国国内清清草原免费视频99
|
九九视频高清视频免费观看
|
中文字幕亚洲色图
|
亚洲av无码专区在线观看素人
|
99久久免费观看
|
国产午夜亚洲精品不卡
|