public void recreate()

in core/src/main/java/org/hibernate/ogm/persister/impl/OgmCollectionPersister.java [580:622]


	public void recreate(PersistentCollection collection, Serializable id, SharedSessionContractImplementor session)
			throws HibernateException {

		if ( !isInverse && isRowInsertEnabled() ) {

			if ( log.isDebugEnabled() ) {
				log.debug( "Inserting collection: " + MessageHelper.collectionInfoString( this, id, getFactory() ) );
			}

			AssociationPersister associationPersister = getAssociationPersister( collection.getOwner(), id, session );

			// create all the new entries
			Iterator<?> entries = collection.entries( this );
			if ( entries.hasNext() ) {
				collection.preInsert( this );
				int i = 0;
				int count = 0;
				while ( entries.hasNext() ) {
					final Object entry = entries.next();
					if ( collection.entryExists( entry, i ) ) {
						// TODO: copy/paste from insertRows()
						RowKeyAndTuple keyAndTuple = createAndPutAssociationRowForInsert( id, collection, associationPersister, session, i, entry );
						updateInverseSideOfAssociationNavigation( session, entry, associationPersister.getAssociationKey(), keyAndTuple.tuple, Action.ADD, keyAndTuple.key );
						collection.afterRowInsert( this, entry, i );
						count++;
					}
					i++;
				}

				associationPersister.flushToDatastore();

				if ( log.isDebugEnabled() ) {
					log.debug( "done inserting collection: " + count + " rows inserted" );
				}

			}
			else {
				if ( log.isDebugEnabled() ) {
					log.debug( "collection was empty" );
				}
			}
		}
	}