Interface ManagedEntity

All Superinterfaces:
InstanceIdentity, Managed, PrimeAmongSecondarySupertypes

public interface ManagedEntity extends Managed, InstanceIdentity
Specialized Managed contract for entity classes, providing access to information about the association between the instance and the PersistenceContext, including:
  • Method Details

    • $$_hibernate_getEntityInstance

      Object $$_hibernate_getEntityInstance()
      Obtain a reference to the entity instance.
      Returns:
      The entity instance.
    • $$_hibernate_getEntityEntry

      EntityEntry $$_hibernate_getEntityEntry()
      Provides access to the associated EntityEntry.
      Returns:
      The EntityEntry associated with this entity instance.
      See Also:
    • $$_hibernate_setEntityEntry

      void $$_hibernate_setEntityEntry(EntityEntry entityEntry)
      Injects the EntityEntry associated with this entity instance. The EntityEntry holds information about the association between the instance and the persistence context.
      Parameters:
      entityEntry - The EntityEntry associated with this entity instance.
    • $$_hibernate_getPreviousManagedEntity

      ManagedEntity $$_hibernate_getPreviousManagedEntity()
      Part of entry linking; obtain reference to the previous entry. Can be null, which should indicate this is the head node.
      Returns:
      The previous entry
    • $$_hibernate_setPreviousManagedEntity

      void $$_hibernate_setPreviousManagedEntity(ManagedEntity previous)
      Part of entry linking; sets the previous entry. Again, can be null, which should indicate this is (now) the head node.
      Parameters:
      previous - The previous entry
    • $$_hibernate_getNextManagedEntity

      ManagedEntity $$_hibernate_getNextManagedEntity()
      Part of entry linking; obtain reference to the next entry. Can be null, which should indicate this is the tail node.
      Returns:
      The next entry
    • $$_hibernate_setNextManagedEntity

      void $$_hibernate_setNextManagedEntity(ManagedEntity next)
      Part of entry linking; sets the next entry. Again, can be null, which should indicate this is (now) the tail node.
      Parameters:
      next - The next entry
    • $$_hibernate_setUseTracker

      void $$_hibernate_setUseTracker(boolean useTracker)
      Used to understand if the tracker can be used to detect dirty properties.
      @Entity
      class MyEntity{
              @Id Integer id
              String name
      }
      
      inSession(session -> {
                      MyEntity entity = new MyEntity(1, "Poul");
                      session.persist(entity);
      });
      
      
      inSession(session -> {
                      MyEntity entity = new MyEntity(1, null);
                      session.merge(entity);
      });
      
      Because the attribute name has been set to null, the SelfDirtyTracker does not detect any change and so doesn't mark the attribute as dirty so the merge does not perform any update.
      Parameters:
      useTracker - true if the tracker can be used to detect dirty properties; false otherwise
    • $$_hibernate_useTracker

      boolean $$_hibernate_useTracker()
      Can the tracker be used to detect dirty attributes
      Returns:
      true if the tracker can be used to detect dirty properties, false otherwise
    • asManagedEntity

      default ManagedEntity asManagedEntity()
      Special internal contract to optimize type checking
      Specified by:
      asManagedEntity in interface PrimeAmongSecondarySupertypes
      Returns:
      this same instance
      See Also:
    • $$_hibernate_setPersistenceInfo

      default EntityEntry $$_hibernate_setPersistenceInfo(EntityEntry entityEntry, ManagedEntity previous, ManagedEntity next, int instanceId)
      Utility method that allows injecting all persistence-related information on the managed entity at once.
      Parameters:
      entityEntry - the EntityEntry associated with this entity instance
      previous - the previous entry
      next - the next entry
      instanceId - unique identifier for this instance
      Returns:
      the previous EntityEntry contained in this managed entity, or null
      Since:
      7.0
      See Also: