Object owner = session.getPersistenceContext().getCollectionOwner( id, this );
// Remove all the old entries
AssociationPersister associationPersister = getAssociationPersister( owner, id, session );
Association association = associationPersister.getAssociationOrNull();
if ( association != null ) {
// shortcut to avoid loop if we can
if ( associationType != AssociationType.OTHER ) {
for ( RowKey assocEntryKey : association.getKeys() ) {
// we unfortunately cannot mass change the update of the associated entity
updateInverseSideOfAssociationNavigation(
session,
null,
association.get( assocEntryKey ),
Action.REMOVE,
assocEntryKey
);
}
}
association.clear();
associationPersister.flushToDatastore();
}
if ( log.isDebugEnabled() ) {