update时候出现如下错误
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:
解决方法:
根据id得到缓存里的pojo对象,修改该对象,更新该对象
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:
解决方法:
根据id得到缓存里的pojo对象,修改该对象,更新该对象
public void update(AppInfo appInfo){
AppInfo ai = getAIById(appInfo.getId());
ai.setAct(appInfo.getAct());
ai.setApp_name(appInfo.getApp_name());
ai.setApp_id(appInfo.getApp_id());
ai.setInstall_ram_range(appInfo.getInstall_ram_range());
ai.setPackage_name(appInfo.getPackage_name());
ai.setSwitch_ram_range(appInfo.getSwitch_ram_range());
Transaction ts = s.beginTransaction();
s.update(ai);
ts.commit();
}