問題描述
我有一個使用 Hibernate 和 DB2 for iSeries
的 Java Web 應用程序,在更新表期間我收到以下錯誤:-
I have a Java Web application using Hibernate and DB2 for iSeries
and during update of a table I get he following error:-
更新 DB2 時出錯 SQL7008iSeries 表
Error SQL7008 while updating a DB2 for iSeries table
推薦答案
通過對該錯誤消息進行一些谷歌搜索,我注意到當您在非事務模式下運行插入/更新時會發生這種情況.這里給出了解釋.
From doing some googling on this error message I noticed that it happens when you are running an insert/update in a non-transactional mode. The explanation is given here.
發生這種情況是因為您所在的表試圖更新不是已記錄,您的更新正在在事務中運行.
This occurs because the table you are trying to update is not being journalled, and your update is being run within a transaction.
通常,您應該始終提交(并在發生異常時回滾)您的事務.通常我從不將自動提交設置為 true,但在這種情況下,我想了解它是否真的需要,如上面鏈接中所述.您可以在連接中將自動提交設置為 true
以查看這是否會消失嗎?
Generally, you should always commit (and rollback if an exception occurs) your transactions. Usually I never set auto commit to true but in this case I would like to understand if it's truly needed as mentioned in the link above. Can you set the auto commit to true
in your connection to see if this goes away?
<property name="hibernate.connection.autocommit" value="true"/>
這個鏈接還有一些關于hibernate事務管理的教程.
Also this link has some tutorials on transaction management with hibernate.
這篇關于更新 DB2 for iSeries 表時出錯 SQL7008的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!