HHH-18289 with leads to HibernateException: A collection with cascade= was no longer referenced by the owning entity instance
This commit is contained in:
parent
7843051f05
commit
88882cd2d8
|
@ -654,7 +654,12 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
final Object owner,
|
final Object owner,
|
||||||
final Map<Object, Object> copyCache) throws HibernateException {
|
final Map<Object, Object> copyCache) throws HibernateException {
|
||||||
if ( original == null ) {
|
if ( original == null ) {
|
||||||
return null;
|
if ( target == null ) {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
final Collection collection = (Collection) target;
|
||||||
|
collection.clear();
|
||||||
|
return collection;
|
||||||
}
|
}
|
||||||
if ( !Hibernate.isInitialized( original ) ) {
|
if ( !Hibernate.isInitialized( original ) ) {
|
||||||
if ( ( (PersistentCollection<?>) original ).hasQueuedOperations() ) {
|
if ( ( (PersistentCollection<?>) original ).hasQueuedOperations() ) {
|
||||||
|
|
Loading…
Reference in New Issue