## org.hibernate.event.internal
Class DefaultResolveNaturalIdEventListener

    java.lang.Object
      org.hibernate.event.internal.AbstractReassociateEventListener
          org.hibernate.event.internal.AbstractLockUpgradeEventListener
              org.hibernate.event.internal.DefaultResolveNaturalIdEventListener

All Implemented Interfaces:
  Serializable, ResolveNaturalIdEventListener

    public class DefaultResolveNaturalIdEventListener

extends AbstractLockUpgradeEventListener
implements ResolveNaturalIdEventListener

Defines the default load event listeners used by hibernate for loading entities in response to generated load events.

See Also:
  Serialized Form

Field Summary
`static Object` `INCONSISTENT_RTN_CLASS_MARKER`
`static Object` `REMOVED_ENTITY_MARKER`

Constructor Summary
`DefaultResolveNaturalIdEventListener()`

Method Summary
`protected Serializable` `loadFromDatasource(ResolveNaturalIdEvent event)` Performs the process of loading an entity from the configured underlying datasource.
`void` `onResolveNaturalId(ResolveNaturalIdEvent event)` Handle the given resolve natural id event.
`protected Serializable` `resolveFromCache(ResolveNaturalIdEvent event)` Attempts to resolve the entity id corresponding to the event's natural id values from the session
`protected Serializable` `resolveNaturalId(ResolveNaturalIdEvent event)` Coordinates the efforts to load a given entity.

Methods inherited from class org.hibernate.event.internal.AbstractLockUpgradeEventListener
`upgradeLock`

Methods inherited from class org.hibernate.event.internal.AbstractReassociateEventListener
`reassociate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### REMOVED_ENTITY_MARKER

    public static final Object REMOVED_ENTITY_MARKER

### INCONSISTENT_RTN_CLASS_MARKER

    public static final Object INCONSISTENT_RTN_CLASS_MARKER

Constructor Detail

### DefaultResolveNaturalIdEventListener

    public DefaultResolveNaturalIdEventListener()

Method Detail

### 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 Serializable 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 Serializable 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 Serializable 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.

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.