`

identifier of an instance of xxx was altered from 1 to 1

    博客分类:
  • Java
阅读更多

今天测试一个项目,这个项目使用了hibernate和spring,报错信息如下:

org.springframework.orm.hibernate4.HibernateSystemException: identifier of an instance of com.tdr.push.entity.ThreadPushFail was altered from 1 to 1; nested exception is org.hibernate.HibernateException: identifier of an instance of com.tdr.push.entity.ThreadPushFail was altered from 1 to 1

 后来发现是因为实体类中id的属性和hbm.xml配置文件中id的属性不一致造成的。

我实体类中的id属性是:

public class ThreadPushFail {
	private long id;
	/***
	 * 推送消息的id
	 */
	private long pushMessageId;

 

hbm.xml配置文件中id的属性:

<hibernate-mapping>
    <class name="com.tdr.push.entity.ThreadPushFail" table="t_threadPushFail" lazy="true">
        <id name="id" type="int">
            <column name="ID" precision="19" scale="0">
                <comment>主键id</comment>
            </column>
            <generator class="identity"/>
        </id>

 一个是int,一个是long

解决方案:是id的属性保持一致。

 

参考:http://blog.csdn.net/lsbhjshyn/article/details/5287554

 

分享到:
评论

相关推荐

    VclZip pro v3.10.1

    1) If your app currently creates mmBlock archives (spanned directly to hard drive) and you define your own OnGetNextDisk in VCLZip 2.X, you should move your code from this event that handles mmBlock ...

    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....

    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" ...

    计算机网络第六版答案

    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 ...

    Prototype Cheat Sheet

    - **`identify(element)`**: Assigns a unique identifier to an element. - **`immediateDescendants`**: Retrieves immediate child elements. - **`insert(element, {position: content})`**: Inserts content ...

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

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

    微软内部资料-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 ...

    servlet2.4doc

    A FilterChain is an object provided by the servlet container to the developer giving a view into the invocation chain of a filtered request for a resource. FilterConfig - interface javax.servlet....

    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 ...

    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 ...

    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 ...

    Keil MDK 编译 ucOS-II 出现的警告和错误解决

    错误:L6238E:os_cpu_a.o(subr) contains invalid call from '~PRES8 (The user did not require code to preserve 8-byte aligment of 8-byte data objects)' function to 'REQ8 (Codewas permitted to depend on ...

    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 ...

    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 ...

    Java_implementation_of_access_control_identifier_c_The Class

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

    LTE from A to Z (part1 of 3)

    Principles and Motivation of LTE............................................1 1.1 Mobile Radio: Comparison between 3G and 4G..................2 1.1.1 Performance and Mobility Management related Issues...

    微软内部资料-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 ...

    hibernat-session方法

    10. **identifier of an instance of... was altered from... to...** - 这个错误提示表明尝试更改已持久化对象的标识符(ID),这是不被允许的。在`ChangID()`方法中,尝试更改新创建对象的ID,会导致Hibernate发出...

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

    1. Add a comment line to the beginning of your code to include your name, something like this: // HW2 by your name This will serve as the identifier of your homework. 10 points (out of 100) will be ...

Global site tag (gtag.js) - Google Analytics