identifier of an instance of was altered from to null
Hibernate的提示錯誤
Caused by: org.hibernate.HibernateException:
identifier of an instance of ... is alterde from 150 to null
原始碼如下:
這個錯誤是由於在一個事務中更新了主鍵,而主鍵是不能被更新的.
這段程式碼的錯誤在PoItem poItem=new PoItem();
這句程式碼放在for迴圈的外面,因此每次迴圈插入的時候,Hibernate認為只是一個物件,主鍵被更新,因此報錯,如果放在for迴圈裡面,就正常了,每次插入都是一個新的物件.
正確的程式碼如下:
相關推薦
identifier of an instance of was altered from to null
Hibernate的提示錯誤 Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from 150 to null 原始碼如下: List<
identifier of an instance of bean was altered from 1 to 2(持久化物件ID變更)
今天遇到個怪問題,hibernate修改外來鍵id時出現: org.springframework.orm.hibernate3.HibernateSystemException: identifier of an instance of xx altered from 2
org.hibernate.HibernateException: identifier of an instance of 實體類的完整類路徑 was altered from X to X.
org.hibernate.HibernateException: identifier of an instance of 實體類的完整類路徑 was altered from X to X. 有一種可能是 上述“實體類的完整類路徑”的類 中
identifier of an instance of XXX.XXX was altered from n to n+1 異常
造成錯誤的原因是: 利用Hibernate批量新增,傳入實體類引數,這裡是用for迴圈進行批量新增;每迴圈一次,需要重新例項化實體類,但是卻將實體類例項化放在迴圈外面 解決辦法,把要進行CRUD操作
解決org.hibernate.HibernateException: identifier of an instance of com.ahd.entity.Order was altered from2 to 0
錯誤資訊 嚴重: Servlet.service() for servlet [springmvc] in context with path [/order] threw exception [Request processing failed; nested exception i
identifier of an instance of ……was alter from 2 to null
Undefined Error: org.hibernate.HibernateException: identifier of an instance of com.shkco.adsr3.staticdata.vo.ClientGroup was altered from 2 to null Li
identifier of an instance of .. altered to null ---- hibernate exception
identifier of an instance of .. altered to null 是做Hibernate,對一條資料進行復制(新增資料)時遇到的問題 原因: 在SSH框架中,我們常常把事務放在業務邏輯層(Manager),所有業務邏輯完成後才能commit事務
hibernate jpa manyToOne級聯操作時,update時報出identifier of an instance of 問題的解決方案及update問題
最近一直在用Jpa來做專案,jpa的優點這裡我就不多說了,說一下最近使用時解決的一個問題吧。 首先來說,使用jpa進行update操作時,由於呼叫的是jpa封裝好的save方法,所以如果表單頁面中沒有提到的引數,這時儲存的時候,沒有提到的引數就會被置為null,為此我
scrapy+mongodb報錯 TypeError: name must be an instance of str
mongod rap 小寫 erro ror 配置文件 sta name 問題解決 經過各種排查,最後找到原因,在settings文件中配置文件大小寫寫錯了,在pipelines中 mongo_db=crawler.settings.get(‘MONGODB_DB‘),ge
執行時錯誤 terminate called after throwing an instance of 'std l
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
解決 Unable to create an instance of type [com.sun.faces.config.ConfigureListener]
宣告:每個人的的電腦都會因為電腦環境,版本等因素不同,可能解決方法不通用,請大家多點耐心吧,畢竟是幹這行的,開始學習的時候,我搭建SSM框架很多次,有問題無法解決就重頭搭建,bug是有的,但總有一天能克服。 我遇到的問題 Caused by: org.apache.cata
解決方案:terminate called after throwing an instance of 'ros::TimeNotInitializedException'
在ROS中使用ros::Time和ros::Duration時出現瞭如下錯誤: terminate called after throwing an instance of 'ros::TimeNot
Cannot create an instance of OLE DB provider "OraOLEDB.Oracle" for linked server "xxxxxxx".
在SQL SERVER 2008 R2下用Windows 身份認證的登入名建立了一個訪問ORACLE資料庫的連結伺服器xxxxx,測試成功,木有問題,但是其它登入名使用該連結伺服器時,報如下錯誤: 訊息 7302,級別 16,狀態 1,第 1 行 Cannot create an instance of
開啟頁面出現Object reference not set to an instance of an object錯誤
開啟網頁出現 查看出錯的位置,如圖中紅色部分所標,因為系統之前執行正常,所以這部分程式碼是沒有問題的,出問題的函式是get name函式,開啟相應的網頁程式碼,發現 其功能是根據專業程式碼讀取專業名稱,應該就最近增加的相應資料量出現了問題,從資料庫中把相關的表格開啟檢查,果然發現,有的
terminate called after throwing an instance of 'std::regex_error'(C++11)
#PS:要轉載請註明出處,本人版權所有 #PS:這個只是 《 我自己 》理解,如果和你的 #原則相沖突,請諒解,勿噴 最近修改一個程式,增加了一些功能,為了方便移植,要用到C++11的正則表示式(正則用起來順手)。這裡我就想說明的是:TMD,
xcode工程編譯錯誤:"An instance 0xca90200 of class UITableView was deallocated while key value observers were still registered with it"
開始 debugger eve locate obj bsp new 列表 ade An instance 0xca90200 of class UITableView was deallocated while key value observers were still
TypeError: super(type, obj): obj must be an instance or subtype of type
父類 self 出現問題 error upper err ins 方法 sof 問題: qs = super(BnnerCourseAdmin, self).queryset() TypeError: super(type, obj): obj must be an
No enclosing instance of type Face is accessible. Must qualify the allocation with an enclosing inst
剛才在練習內部類的時候遇到了這個報錯: No enclosing instance of type Face is accessible. Must qualify the allocation with an enclosing instance of type Face (e.g. x.ne
Java 報錯No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
解決方案:在Person內部類前面新增static,將內部類宣告為靜態內部類。 原因如下:在Java中 (1)類的靜態方法不能直接呼叫動態方法。 (2)類的靜態方法不能初始化內部類(包括該類的內部類,和其他檔案中的內部類)。 (3)類的靜態方法可以初始化其他類檔
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK fla
今天在專案中碰到的一個錯誤: 專案中涉及到很多Activity之間相互跳轉的程式碼,如下所示的程式碼,感覺很繁瑣,因此想到了封裝一下: Intent intent = new Intent(SplashActivity.this , MainFragmentActivity.class);