Package org.hibernate.event.internal
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
Performs the process of loading an entity from the configured underlying datasource.void
Handle the given resolve natural id event.protected Object
Attempts to resolve the entity id corresponding to the event's natural id values from the sessionprotected Object
Coordinates the efforts to load a given entity.
-
Constructor Details
-
DefaultResolveNaturalIdEventListener
public DefaultResolveNaturalIdEventListener()
-
-
Method Details
-
onResolveNaturalId
Description copied from interface:ResolveNaturalIdEventListener
Handle the given resolve natural id event.- Specified by:
onResolveNaturalId
in interfaceResolveNaturalIdEventListener
- Parameters:
event
- The resolve natural id event to be handled.- Throws:
HibernateException
- Indicates a problem resolving natural id to primary key
-
resolveNaturalId
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
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
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.
-