hibernate错误:org.hibernate.NonUniqueObjectException: a different object with the same identifier valu
来源:互联网 发布:移动网络哪家 编辑:程序博客网 时间:2024/05/21 11:13
if (StringUtil.isNotEmpty(supplyCatalog.getId())) {message = "更新成功";SupplyCatalogEntity t = supplyCatalogService.get(SupplyCatalogEntity.class, supplyCatalog.getId());// 1//org.hibernate.Session session = systemService.getSession();//session.clear();try {if (StringUtil.isNotEmpty(request.getParameter("warehouseId0"))) {t.setWarehouseId(Integer.valueOf(request.getParameter("warehouseId0")));}t.setLatestTime(new Date());t.setLatestUser(this.getSysUserName(request));MyBeanUtils.copyBeanNotNull2Bean(supplyCatalog, t);if (t.getParentCatalog() != null && t.getParentCatalog().getId() == null) {t.setParentCatalog(null);}// 2//SupplyCatalogEntity parent = systemService.get(SupplyCatalogEntity.class, t.getParentCatalog().getId());//t.setParentCatalog(parent);supplyCatalogService.saveOrUpdate(t);systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);} catch (Exception e) {e.printStackTrace();}}
一开始报错:org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session
然后添加了“1”处被注释的代码,这样把session中冲突的实体清除了,不报错了。
但是看数据库,发现父节点的数据记录被清空了,只留了一个id。
之后添加了“2”处的代码,就能存住父节点信息了。
0 0
- hibernate错误:org.hibernate.NonUniqueObjectException: a different object with the same identifier valu
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException:a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: A different object with the same identifier解决方法
- org.hibernate.NonUniqueObjectException:a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was ...
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- 报错信息:Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same ide
- org.hibernate.NonUniqueObjectException: a different object with the same ide
- org.hibernate.NonUniqueObjectException:a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- Transact-SQL 语法规则
- varchar和nvarchar的区别:
- java 正则表达式的一个理解.
- IM 架构
- 开启html元素的编辑模式contenteditable="true"
- hibernate错误:org.hibernate.NonUniqueObjectException: a different object with the same identifier valu
- SurfaceView的用法----实现刚进入程序时渐变场景效果
- od命令
- LayerColor和LayerGradient
- UltraEdit-32 21.00.1030 破解说明
- 使用SeaJS实现模块化JavaScript开发
- mybatis generator 使用
- poj2506--Tiling
- 项目实践