org.hibernate.event.internal.EntityCopyAllowedLoggedObserver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
JPMS Module-Info's for a few of the Jakarta Libraries just until they add them in themselves
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.event.internal;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.hibernate.event.spi.EntityCopyObserver;
import org.hibernate.event.spi.EntityCopyObserverFactory;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.collections.IdentitySet;
import org.hibernate.pretty.MessageHelper;
/**
* An {@link org.hibernate.event.spi.EntityCopyObserver} implementation that allows multiple representations of
* the same persistent entity to be merged and provides logging of the entity copies that
* are detected.
*
* @author Gail Badner
*/
public final class EntityCopyAllowedLoggedObserver implements EntityCopyObserver {
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( EntityCopyAllowedLoggedObserver.class );
public static final EntityCopyObserverFactory FACTORY_OF_SELF = () -> new EntityCopyAllowedLoggedObserver();
public static final String SHORT_NAME = "log";
// Tracks the number of entity copies per entity name.
private Map countsByEntityName;
// managedToMergeEntitiesXref is only maintained for DEBUG logging so that a "nice" message
// about multiple representations can be logged at the completion of the top-level merge.
// If no entity copies have been detected, managedToMergeEntitiesXref will remain null;
private Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy