記錄工作,為了遺忘
posts - 22, comments - 17, trackbacks - 0, articles - 15
BlogJava
::
首頁
::
新隨筆
::
聯系
::
聚合
::
管理
spring+ibatis (MySql)操作clob blob
Posted on 2012-07-18 14:45
碼農cz
閱讀(1270)
評論(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攔截器概述(6533)
2.?利用Java+POI 讀寫Excel文檔&向Excel中插入圖片(1865)
3.?Struts2 在Action類中獲得HttpServletResponse對象的四種方法(1742)
4.?怎樣動態添加文本框并處理(1429)
5.?tomcat5.5日志(1405)
評論排行榜
1.?struts2攔截器概述(8)
2.?Struts2 在Action類中獲得HttpServletResponse對象的四種方法(3)
3.?利用Java+POI 讀寫Excel文檔&向Excel中插入圖片(2)
4.?怎樣動態添加文本框并處理(1)
5.?Servlet和Filter的url匹配以及url-pattern詳解(0)
主站蜘蛛池模板:
免费黄色网址网站
|
一级毛片免费观看不卡视频
|
国产精品入口麻豆免费观看
|
亚洲国产第一站精品蜜芽
|
www免费插插视频
|
高清在线亚洲精品国产二区
|
国产成人亚洲精品91专区高清
|
中国一级特黄高清免费的大片中国一级黄色片
|
日韩免费一区二区三区
|
亚洲Aⅴ在线无码播放毛片一线天
|
青青青青青青久久久免费观看
|
亚洲精品无码专区久久
|
国产在线ts人妖免费视频
|
日韩在线一区二区三区免费视频
|
亚洲日韩在线观看
|
香蕉免费一级视频在线观看
|
亚洲AV无码乱码国产麻豆
|
久久久久久一品道精品免费看
|
亚洲精品成人久久
|
免费电影在线观看网站
|
亚洲AV成人精品日韩一区
|
亚洲无人区午夜福利码高清完整版
|
成人性生交大片免费看中文
|
亚洲精品自拍视频
|
全免费A级毛片免费看网站
|
免费国产a理论片
|
亚洲国产精品无码一线岛国
|
**毛片免费观看久久精品
|
亚洲中文字幕久久久一区
|
全黄a免费一级毛片人人爱
|
国产在线观看无码免费视频
|
亚洲成综合人影院在院播放
|
国产一级特黄高清免费大片
|
9久热这里只有精品免费
|
亚洲精品中文字幕乱码影院
|
国产免费人成在线视频
|
黄色网址在线免费
|
亚洲精品GV天堂无码男同
|
亚洲色欲一区二区三区在线观看
|
麻豆视频免费播放
|
v片免费在线观看
|