Hibernate: How to fix “identifier of an instance altered from X to Y”?

后端 未结 17 2418
org.hibernate.HibernateException: identifier of an instance 
of org.cometd.hibernate.User altered from 12 to 3

in fact, my user table

17条回答
  •  被撕碎了的回忆
    2020-12-01 07:56

    Problem can be also in different types of object's PK ("User" in your case) and type you ask hibernate to get session.get(type, id);.

    In my case error was identifier of an instance of was altered from 16 to 32. Object's PK type was Integer, hibernate was asked for Long type.

提交回复
热议问题