Class DefaultPostLoaderDao

java.lang.Object
org.broadleafcommerce.common.persistence.DefaultPostLoaderDao
All Implemented Interfaces:
PostLoaderDao, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Component("blPostLoaderDao") public class DefaultPostLoaderDao extends Object implements PostLoaderDao, org.springframework.context.ApplicationContextAware
Author:
Nathan Moore (nathanmoore).
  • Field Details

    • LOG

      protected static final org.apache.commons.logging.Log LOG
    • persistenceService

      protected PersistenceService persistenceService
  • Constructor Details

    • DefaultPostLoaderDao

      public DefaultPostLoaderDao()
  • Method Details

    • getPostLoaderDao

      public static PostLoaderDao getPostLoaderDao()
    • resetApplicationContext

      public static void resetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      see org.broadleafcommerce.test.TestNGSiteIntegrationSetup#reSetApplicationContext()
      Parameters:
      applicationContext -
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • find

      public <T> T find(Class<T> clazz, Object id)
      Find and return the entity by primary key and class.

      Delegates find to EntityManager.find(Class, Object).

      Specified by:
      find in interface PostLoaderDao
      Parameters:
      clazz - entity class
      id - primary key
      Returns:
      managed entity or null if not found
    • findSandboxEntity

      public <T> T findSandboxEntity(Class<T> clazz, Object id)
      Description copied from interface: PostLoaderDao
      If within the context of a sandbox, return the sandbox entity by primary key and class.

      This purposefully uses the Entity Manager in order to trigger the hibernate filters.

      Specified by:
      findSandboxEntity in interface PostLoaderDao
      Returns:
    • evict

      public void evict(Class<?> clazz, Object id)
      Specified by:
      evict in interface PostLoaderDao
    • evict

      public void evict(Object entity)
      Specified by:
      evict in interface PostLoaderDao
    • getEntityManager

      protected jakarta.persistence.EntityManager getEntityManager(Class clazz)