`

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循环里面,就正常了,每次插入都是一个新的对象.
正确的代码如下:

分享到:
评论

相关推荐

    Oracle数据库表名支持的最大长度是多少

    本文介绍Oralce数据库中,表名可以使用的最大长度。这个长度也是Oracle...*Cause: An identifier with more than 30 characters was specified. *Action: Specify at most 30 characters. 从这个错误提示可以看出

    The Digital Object Identifier initiative: metadata implications

    The Digital Object Identifier initiative: metadata implications Context/status information The purpose of this document is to generate a DOI Foundation consensus paper on metadata, as a companion ...

    servlet2.4doc

    Returns the value of the named attribute as an Object, or null if no attribute of the given name exists. getAttribute(String) - Method in interface javax.servlet.http.HttpSession Returns the object ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object....

    VclZip pro v3.10.1

    If you currently work with VCLZip 2.X with TBlobStreams or some other type of streams, you can either define your own TkpBlobStream for instance which inherits from TkpHugeStream, or use the ...

    微软内部资料-SQL性能优化5

    An index consists of a tree with a root from which the navigation begins, possible intermediate index levels, and bottom-level leaf pages. You use the index to find the correct leaf page. The number ...

    计算机网络第六版答案

    Wifi (802.11) In a wireless LAN, wireless users transmit/receive packets to/from an base station (i.e., wireless access point) within a radius of few tens of meters. The base station is typically ...

    微软内部资料-SQL性能优化3

    For an example of how to decode value from this column using the information above, let us assume we have the following value: 0x000705001F83D775010002014F0BEC4E With byte swapping within each ...

    eac3to V3.17

    * fixed: number of subtitles was not appended to demuxed subtitles' file name * fixed: dialnorm removal (for Nero decoder) failed with some 2.0 TrueHD files v3.16 * added undocumented "-no2ndpass" ...

    NewSID(光学习一下代码就可以了,没看清楚介绍别运行)

    While this method saves hours of work and hassle over other rollout approaches, it has the major problem that every cloned system has an identical Computer Security Identifier (SID). This fact ...

    S7A驱动720版本

    - The own address of CIF50 MPI/PB communication way was limited to 31. Now the limit is 126. - Bug-fix in PG-PC Interface (CP5611) communication way. Device could be disabled from polling, after ...

    park an autonomous vehicle

    1. A practical approach to motion generation and control for an omnidirectional mobile robot Paromtchik, I.E.; Rembold, U. Robotics and Automation, 1994. Proceedings., 1994 IEEE International ...

    Java_implementation_of_access_control_identifier_c_The Class

    Java实现标识符对类的访问控制代码Java implementation of access control identifier code of the class

    Wireless Identification.pdf

    We are in the era of ubiquitous computing in which the use ...identifier (or an anonymized version of that), which allows the unequivocal identification of the tag holder (i.e. person, animal, or items).

    sqlserverSET QUOTED_IDENTIFIER ON

    ALTER PROCEDURE test @From varchar(100)="zhang.zhanling@itgemini.net" , @To varchar(100)="zhang.zhanling@itgemini.net" ,@eng varchar(1000)=" ", @Bcc varchar(500)="xu.ming;xie.yansheng", @Subject ...

    Python-KaggleInstacart市场篮子分析

    order_hour_of_day: the hour of the day the order was placed on days_since_prior: days since the last order, capped at 30 (with NAs for order_number = 1) products (50k rows): product_id: product ...

    LTE from A to Z

    1.2.3.4.3 SFN for point to point services..............................................25 1.2.3.5 The Frequency Bands Intended for LTE.......................................26 1.2.3.5.1 Exclusive ...

    留学生React Native计算器作业-待视频演示.zip

    The user can enter a number to each of the two textinput boxes, then click/tap either of the four images of mathematical operators. Once clicked, it should display a correct answer on the screen. 1. ...

    aes 加密代码

    A URI was used to allow anybody to define extension types, though we should strive to define a standard set of extensions. Examples of standard extension identifiers: CREATED-DATE CREATED-BY A ...

    5G安全白皮书,比较全

    Granularity of Anchor Key Binding to Serving Network Mitigation of Bidding Down Attacks Service Requirements 5G Identifiers Subscription Permanent Identifier (SUPI) Subscription concealed ...

Global site tag (gtag.js) - Google Analytics