Class HibernateLazyLoadingDelegate

java.lang.Object
com.vaadin.featurepack.data.jpacontainer.util.HibernateLazyLoadingDelegate
All Implemented Interfaces:
LazyLoadingDelegate

public class HibernateLazyLoadingDelegate extends Object implements 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 Details

    • HibernateLazyLoadingDelegate

      public HibernateLazyLoadingDelegate()
  • Method Details

    • setEntityProvider

      public void setEntityProvider(EntityProvider<?> ep)
      Description copied from interface: LazyLoadingDelegate
      Sets the EntityProvider that this delegate is associated with. Automatically called by EntityProvider.setLazyLoadingDelegate(LazyLoadingDelegate). The EntityProvider is used to get the current EntityManager.
      Specified by:
      setEntityProvider in interface LazyLoadingDelegate
      Parameters:
      ep -
    • ensureLazyPropertyLoaded

      public <E> E ensureLazyPropertyLoaded(E entity, String propertyName)
      Description copied from interface: LazyLoadingDelegate
      This 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 of entity that is returned.
      Specified by:
      ensureLazyPropertyLoaded in interface LazyLoadingDelegate
      Parameters:
      entity - The entity containing a lazy property.
      propertyName - The name of the lazy property to be accessed.
      Returns:
      an instance of entity with propertyName attached and accessible. This may be the same instance as passed in or a new one.