2727import org .hibernate .engine .spi .SharedSessionContractImplementor ;
2828import org .hibernate .engine .spi .Status ;
2929import org .hibernate .engine .spi .TypedValue ;
30- import org .hibernate .internal .CoreLogging ;
31- import org .hibernate .internal .CoreMessageLogger ;
3230import org .hibernate .internal .SessionFactoryRegistry ;
3331import org .hibernate .internal .util .MarkerObject ;
3432import org .hibernate .internal .util .collections .IdentitySet ;
4038import org .checkerframework .checker .nullness .qual .Nullable ;
4139
4240import static java .util .Collections .emptyList ;
41+ import static org .hibernate .collection .internal .CollectionLogger .COLLECTION_LOGGER ;
4342import static org .hibernate .engine .internal .ForeignKeys .getEntityIdentifier ;
4443import static org .hibernate .engine .internal .ForeignKeys .getEntityIdentifierIfNotUnsaved ;
4544import static org .hibernate .engine .internal .ForeignKeys .isNotTransient ;
5756 */
5857public abstract class AbstractPersistentCollection <E > implements Serializable , PersistentCollection <E > {
5958
60- private static final CoreMessageLogger LOG = CoreLogging .messageLogger ( AbstractPersistentCollection .class );
61-
6259 private transient SharedSessionContractImplementor session ;
6360 private boolean isTempSession = false ;
6461
@@ -298,7 +295,7 @@ else if ( !session.isConnected() ) {
298295 tempSession .close ();
299296 }
300297 catch (Exception e ) {
301- LOG .unableToCloseTemporarySession ();
298+ COLLECTION_LOGGER .unableToCloseTemporarySession ();
302299 }
303300 }
304301 else {
@@ -706,15 +703,15 @@ public final boolean unsetSession(SharedSessionContractImplementor currentSessio
706703 if ( allowLoadOutsideTransaction
707704 && !initialized
708705 && session .getLoadQueryInfluencers ().hasEnabledFilters () ) {
709- LOG .enabledFiltersWhenDetachFromSession ( collectionInfoString ( getRole (), getKey () ) );
706+ COLLECTION_LOGGER .enabledFiltersWhenDetachFromSession ( collectionInfoString ( getRole (), getKey () ) );
710707 }
711708 session = null ;
712709 }
713710 return true ;
714711 }
715712 else {
716713 if ( session != null ) {
717- LOG .logCannotUnsetUnexpectedSessionInCollection ( unexpectedSessionStateMessage ( currentSession ) );
714+ COLLECTION_LOGGER .logCannotUnsetUnexpectedSessionInCollection ( unexpectedSessionStateMessage ( currentSession ) );
718715 }
719716 return false ;
720717 }
@@ -724,20 +721,20 @@ private void logDiscardedQueuedOperations() {
724721 try {
725722 if ( wasTransactionRolledBack () ) {
726723 // It was due to a rollback.
727- if ( LOG .isDebugEnabled ()) {
728- LOG .queuedOperationWhenDetachFromSessionOnRollback ( collectionInfoString ( getRole (), getKey () ) );
724+ if ( COLLECTION_LOGGER .isDebugEnabled ()) {
725+ COLLECTION_LOGGER .queuedOperationWhenDetachFromSessionOnRollback ( collectionInfoString ( getRole (), getKey () ) );
729726 }
730727 }
731728 else {
732729 // We don't know why the collection is being detached.
733730 // Just log the info.
734- LOG .queuedOperationWhenDetachFromSession ( collectionInfoString ( getRole (), getKey () ) );
731+ COLLECTION_LOGGER .queuedOperationWhenDetachFromSession ( collectionInfoString ( getRole (), getKey () ) );
735732 }
736733 }
737734 catch (Exception e ) {
738735 // We don't know why the collection is being detached.
739736 // Just log the info.
740- LOG .queuedOperationWhenDetachFromSession ( collectionInfoString ( getRole (), getKey () ) );
737+ COLLECTION_LOGGER .queuedOperationWhenDetachFromSession ( collectionInfoString ( getRole (), getKey () ) );
741738 }
742739 }
743740
@@ -772,11 +769,11 @@ else if ( this.session != null ) {
772769 );
773770 }
774771 else {
775- LOG .logUnexpectedSessionInCollectionNotConnected ( message );
772+ COLLECTION_LOGGER .logUnexpectedSessionInCollectionNotConnected ( message );
776773 }
777774 }
778775 if ( hasQueuedOperations () ) {
779- LOG .queuedOperationWhenAttachToSession ( collectionInfoString ( getRole (), getKey () ) );
776+ COLLECTION_LOGGER .queuedOperationWhenAttachToSession ( collectionInfoString ( getRole (), getKey () ) );
780777 }
781778 this .session = session ;
782779 return true ;
@@ -808,7 +805,7 @@ private String unexpectedSessionStateMessage(SharedSessionContractImplementor se
808805 }
809806 }
810807 // only include the collection contents if debug logging
811- if ( LOG .isDebugEnabled () ) {
808+ if ( COLLECTION_LOGGER .isDebugEnabled () ) {
812809 final String collectionContents = wasInitialized () ? toString () : "<uninitialized>" ;
813810 message .append ( "\n Collection contents: [" ).append ( collectionContents ).append ( "]" );
814811 }
0 commit comments