我收到的时候我想改变我的以下异常@ID中的@Entity.
identifier of an instance of com.google.search.pagerank.ItemEntity was altered from 1 to 2.
Run Code Online (Sandbox Code Playgroud)
我知道我正在改变表格中的主键.我正在使用JPA-annotations.
我通过使用这个单个HQL查询解决了这个问题: update Table set name=:newName where name=:oldName
而不是使用更多的OO方法:
beginTransaction();
T e = session.load(...);
e.setName(newName);
session.saveOrUdate(e);
commit();
Run Code Online (Sandbox Code Playgroud)
知道差异是什么吗?