Class HibernateLazyLoadingDelegate
java.lang.Object
com.vaadin.featurepack.data.jpacontainer.util.HibernateLazyLoadingDelegate
- All Implemented Interfaces:
LazyLoadingDelegate
HibernateLazyLoadingDelegate is the default implementation of the
LazyLoadingDelegate interface for use with Hibernate. Note that
EclipseLink does not require any lazy loading delegates in order for lazy
loading to transparently work.
HibernateLazyLoadingDelegate handles lazy loaded properties by explicitly
loading the property in question from the database and attaching it to the
entity passed in. This happens recursively if the property is nested.- Since:
- 2.0
- Author:
- Jonatan Kronqvist / Vaadin Ltd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E> EensureLazyPropertyLoaded(E entity, String propertyName) This method is called when a lazily loaded property is accessed in an entity.voidsetEntityProvider(EntityProvider<?> ep) Sets the EntityProvider that this delegate is associated with.
-
Constructor Details
-
HibernateLazyLoadingDelegate
public HibernateLazyLoadingDelegate()
-
-
Method Details
-
setEntityProvider
Description copied from interface:LazyLoadingDelegateSets the EntityProvider that this delegate is associated with. Automatically called byEntityProvider.setLazyLoadingDelegate(LazyLoadingDelegate). The EntityProvider is used to get the currentEntityManager.- Specified by:
setEntityProviderin interfaceLazyLoadingDelegate- Parameters:
ep-
-
ensureLazyPropertyLoaded
Description copied from interface:LazyLoadingDelegateThis method is called when a lazily loaded property is accessed in an entity. The implementation of this method is responsible for ensuring that the property in question is accessible on the instance ofentitythat is returned.- Specified by:
ensureLazyPropertyLoadedin interfaceLazyLoadingDelegate- Parameters:
entity- The entity containing a lazy property.propertyName- The name of the lazy property to be accessed.- Returns:
- an instance of
entitywithpropertyNameattached and accessible. This may be the same instance as passed in or a new one.
-