/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, CollectionType type) throws HibernateException { if ( collection.wasInitialized() ) { CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( type.getRole() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } }
/** * {@inheritDoc} */ @Override Object processComponent(Object component, CompositeType componentType) throws HibernateException { Type[] types = componentType.getSubtypes(); if ( component == null ) { processValues( new Object[types.length], types ); } else { super.processComponent( component, componentType ); } return null; }
Object processEntity(Object value, EntityType entityType) throws HibernateException { if (value!=null) { getSession().getPersistenceContext().reassociateIfUninitializedProxy(value); // if it is an initialized proxy, let cascade // handle it later on } return null; }
/** * Has the owner of the collection changed since the collection * was snapshotted and detached? */ protected static boolean isOwnerUnchanged( final PersistentCollection snapshot, final CollectionPersister persister, final Serializable id ) { return isCollectionSnapshotValid(snapshot) && persister.getRole().equals( snapshot.getRole() ) && id.equals( snapshot.getKey() ); }
Object processEntity(Object value, EntityType entityType) throws HibernateException { if (value!=null) { getSession().getPersistenceContext().reassociateIfUninitializedProxy(value); // if it is an initialized proxy, let cascade // handle it later on } return null; }
/** * Has the owner of the collection changed since the collection * was snapshotted and detached? */ protected static boolean isOwnerUnchanged( final PersistentCollection snapshot, final CollectionPersister persister, final Serializable id ) { return isCollectionSnapshotValid(snapshot) && persister.getRole().equals( snapshot.getRole() ) && id.equals( snapshot.getKey() ); }
/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, CollectionType type) throws HibernateException { if ( collection.wasInitialized() ) { CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( type.getRole() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } }
@Override Object processEntity(Object value, EntityTypeDescriptor descriptor) throws HibernateException { if (value!=null) { getSession().getPersistenceContext().reassociateIfUninitializedProxy(value); // if it is an initialized proxy, let cascade // handle it later on } return null; }
/** * Has the owner of the collection changed since the collection * was snapshotted and detached? */ protected static boolean isOwnerUnchanged( final PersistentCollection snapshot, final CollectionPersister persister, final Serializable id ) { return isCollectionSnapshotValid(snapshot) && persister.getRole().equals( snapshot.getRole() ) && id.equals( snapshot.getKey() ); }
/** * {@inheritDoc} */ @Override Object processComponent(Object component, EmbeddedTypeDescriptor descriptor) throws HibernateException { final Collection subclassTypes = descriptor.getSubclassTypes(); if ( subclassTypes == null ) { processValues( new Object[subclassTypes.size()], subclassTypes ); } else { super.processComponent( component, descriptor ); } return null; }
/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, CollectionType type) throws HibernateException { if ( collection.wasInitialized() ) { CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( type.getRole() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionPersister, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } CollectionPersister collectionPersister = getSession().getFactory() .getCollectionPersister( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionPersister, collection ); } }
Object processEntity(Object value, EntityType entityType) throws HibernateException { if (value!=null) { getSession().getPersistenceContext().reassociateIfUninitializedProxy(value); // if it is an initialized proxy, let cascade // handle it later on } return null; }
/** * Has the owner of the collection changed since the collection * was snapshotted and detached? */ protected static boolean isOwnerUnchanged( final PersistentCollection snapshot, final PersistentCollectionDescriptor descriptor, final Serializable id ) { return isCollectionSnapshotValid(snapshot) && descriptor.getNavigableRole().getFullPath().equals( snapshot.getRole() ) && id.equals( snapshot.getKey() ); }
/** * {@inheritDoc} */ @Override Object processComponent(Object component, CompositeType componentType) throws HibernateException { Type[] types = componentType.getSubtypes(); if ( component == null ) { processValues( new Object[types.length], types ); } else { super.processComponent( component, componentType ); } return null; }
/** * Reattach a detached (disassociated) initialized or uninitialized * collection wrapper, using a snapshot carried with the collection * wrapper */ protected void reattachCollection(PersistentCollection collection, NavigableRole role) throws HibernateException { if ( collection.wasInitialized() ) { PersistentCollectionDescriptor collectionDescriptor = getSession().getFactory().getMetamodel() .findCollectionDescriptor( role.getFullPath() ); getSession().getPersistenceContext() .addInitializedDetachedCollection( collectionDescriptor, collection ); } else { if ( !isCollectionSnapshotValid(collection) ) { throw new HibernateException( "could not reassociate uninitialized transient collection" ); } PersistentCollectionDescriptor collectionDescriptor = getSession().getFactory().getMetamodel() .findCollectionDescriptor( collection.getRole() ); getSession().getPersistenceContext() .addUninitializedDetachedCollection( collectionDescriptor, collection ); } }
/** * {@inheritDoc} */ @Override Object processComponent(Object component, CompositeType componentType) throws HibernateException { Type[] types = componentType.getSubtypes(); if ( component == null ) { processValues( new Object[types.length], types ); } else { super.processComponent( component, componentType ); } return null; }