}
return builder;
}
private RowKey getTupleKeyForUpdate(Serializable key, PersistentCollection collection, SessionImplementor session, int i, Object entry, AssociationPersister associationPersister) {
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 );
}
else {
getKeyGridType().nullSafeSet( tuple, key, getKeyColumnNames(), session );
// No need to write to where as we don't do where clauses in OGM :)
if ( !isOneToMany() && hasIndex && !indexContainsFormula ) {
Object index = collection.getIndex( entry, i, this );
indexGridType.nullSafeSet( tuple, incrementIndexByBase( index ), getIndexColumnNames(), session );
}
else {
final Object snapshotElement = collection.getSnapshotElement( entry, i );
if ( elementIsPureFormula ) {
throw new AssertionFailure( "cannot use a formula-based element in the where condition" );
}
getElementGridType().nullSafeSet( tuple, snapshotElement, getElementColumnNames(), session );
}
}
rowKeyBuilder.values( tuple );
return rowKeyBuilder.build();
}