Class DefaultResolveNaturalIdEventListener

java.lang.Object
org.hibernate.event.internal.DefaultResolveNaturalIdEventListener
All Implemented Interfaces:
ResolveNaturalIdEventListener

public class DefaultResolveNaturalIdEventListener extends Object implements ResolveNaturalIdEventListener
Defines the default load event listeners used by hibernate for loading entities in response to generated load events.
  • Constructor Details

    • DefaultResolveNaturalIdEventListener

      public DefaultResolveNaturalIdEventListener()
  • Method Details

    • onResolveNaturalId

      public void onResolveNaturalId(ResolveNaturalIdEvent event) throws HibernateException
      Description copied from interface: ResolveNaturalIdEventListener
      Handle the given resolve natural id event.
      Specified by:
      onResolveNaturalId in interface ResolveNaturalIdEventListener
      Parameters:
      event - The resolve natural id event to be handled.
      Throws:
      HibernateException - Indicates a problem resolving natural id to primary key
    • resolveNaturalId

      protected Object resolveNaturalId(ResolveNaturalIdEvent event)
      Coordinates the efforts to load a given entity. First, an attempt is made to load the entity from the session-level cache. If not found there, an attempt is made to locate it in second-level cache. Lastly, an attempt is made to load it directly from the datasource.
      Parameters:
      event - The load event
      Returns:
      The loaded entity, or null.
    • resolveFromCache

      protected Object resolveFromCache(ResolveNaturalIdEvent event)
      Attempts to resolve the entity id corresponding to the event's natural id values from the session
      Parameters:
      event - The load event
      Returns:
      The entity from the cache, or null.
    • loadFromDatasource

      protected Object loadFromDatasource(ResolveNaturalIdEvent event)
      Performs the process of loading an entity from the configured underlying datasource.
      Parameters:
      event - The load event
      Returns:
      The object loaded from the datasource, or null if not found.