getElementGridType().nullSafeSet( keyAndTuple.tuple, element, getElementColumnNames(), session );
}
private RowKeyAndTuple createAndPutTupleforInsert(Serializable key, PersistentCollection collection,
AssociationPersister associationPersister, SessionImplementor session, int i, Object entry) {
RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder();
Tuple tuple = new Tuple();
if ( hasIdentifier ) {
final Object identifier = collection.getIdentifier( entry, i );
String[] names = { getIdentifierColumnName() };
identifierGridType.nullSafeSet( tuple, identifier, names, session );
}
getKeyGridType().nullSafeSet( tuple, key, getKeyColumnNames(), session );
// No need to write to where as we don't do where clauses in OGM :)
if ( hasIndex ) {
Object index = collection.getIndex( entry, i, this );
indexGridType.nullSafeSet( tuple, incrementIndexByBase( index ), getIndexColumnNames(), session );
}
else {
// use element as tuple key
final Object element = collection.getElement( entry );
getElementGridType().nullSafeSet( tuple, element, getElementColumnNames(), session );
}
RowKeyAndTuple result = new RowKeyAndTuple();
EntityKey entityKey = associationPersister.createTargetKey( rowKeyBuilder.getColumnNames(), tuple );
result.key = rowKeyBuilder.values( tuple ).entityKey( entityKey ).build();
Tuple assocEntryTuple = associationPersister.createAndPutAssociationTuple( result.key );
for ( String column : tuple.getColumnNames() ) {
assocEntryTuple.put( column, tuple.get( column ) );
}