Caused by: org.hibernate.AssertionFailure: collection owner not associated with

Caused by: org.hibernate.AssertionFailure: collection owner not associated with session

 

[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R Caused by: org.hibernate.AssertionFailure: collection owner not associated with session: com.shkco.adsr3.cbm.vo.SubAccount.authorizors
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at org.hibernate.engine.internal.Collections.processDereferencedCollection(Collections.java:105)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at org.hibernate.engine.internal.Collections.processUnreachableCollection(Collections.java:66)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at org.hibernate.event.internal.AbstractFlushingEventListener.flushCollections(AbstractFlushingEventListener.java:248)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:101)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1240)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at com.shkco.adsr3.framework.dao.SessionWrapper.flush(SessionWrapper.java:209)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at com.shkco.adsr3.framework.dao.AbstractDAO.saveAll(AbstractDAO.java:230)
[13/01/16 11:14:47:779 CST] 00000127 SystemErr     R 	at com.shkco.adsr3.framework.dao.AbstractDAO.saveAll(AbstractDAO.java:212)

 

save vo 的报以上错误。。。

因为对db对象做了操作

Set<IAddress> addressSet = (Set<IAddress>)ObjectUtil.deepCopy(tempAddressSet);

造成session不一致,所以在对象改变之后使用evict方法清除一下缓存session。

 

subAccountService.evict(subAccount);

你可能感兴趣的:(Hibernate,Associated)