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

后端 未结 17 2420
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:57

    In my case, a template had a typo so instead of checking for equivalency (==) it was using an assignment equals (=).

    So I changed the template logic from:

    if (user1.id = user2.id) ...
    

    to

    if (user1.id == user2.id) ...
    

    and now everything is fine. So, check your views as well!

提交回复
热议问题