Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -687,27 +687,31 @@ public void remove(Serializable id, SessionImplementor session) throws Hibernate
.collectionPersister( this )
.session( session );

// shortcut to avoid loop if we can
if ( associationType != AssociationType.OTHER ) {
for ( RowKey assocEntryKey : associationPersister.getAssociation().getKeys() ) {
// we unfortunately cannot mass change the update of the associated entity
updateInverseSideOfAssociationNavigation(
session,
null,
associationPersister.getAssociation().get( assocEntryKey ),
Action.REMOVE,
assocEntryKey
);
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
);
}
}
}
associationPersister.getAssociation().clear();
association.clear();

if ( associationPersister.hostingEntityRequiresReadAfterUpdate() ) {
Object owner = session.getPersistenceContext().getCollectionOwner( id, this );
associationPersister.hostingEntity( owner );
}
if ( associationPersister.hostingEntityRequiresReadAfterUpdate() ) {
Object owner = session.getPersistenceContext().getCollectionOwner( id, this );
associationPersister.hostingEntity( owner );
}

associationPersister.flushToCache();
associationPersister.flushToCache();
}

if ( log.isDebugEnabled() ) {
log.debug( "done deleting collection" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ private void updateHostingEntityIfRequired() {
* Whether the association in question is stored within an entity structure ("embedded") and this entity has
* properties whose value is generated in the datastore (such as a version attribute) or not.
*
* @param metadataProvider persister of the association
* @param ownerPersister persister of the owning entity
* @return {@code true} in case the represented association is stored within an entity which has server-generated
* properties, and thus must be re-read after an update to the association, {@code false} otherwise.
*/
Expand Down