Class HibernateMappingProvider

java.lang.Object
org.broadleafcommerce.common.util.dao.HibernateMappingProvider
All Implemented Interfaces:
org.hibernate.boot.spi.SessionFactoryBuilderFactory

public class HibernateMappingProvider extends Object implements org.hibernate.boot.spi.SessionFactoryBuilderFactory

Hibernate SPI implementor that harvests metadata about all of the entity classes

This is registered within META-INF/services/org.hibernate.boot.spi.SessionFactoryBuilderFactory and listens to the session factory being created with all of the metadata

Author:
Jeff Fischer, Phillip Verheyden (phillipuniverse)
  • Constructor Details

  • Method Details

    • getMapping

      @Nullable public static org.hibernate.mapping.PersistentClass getMapping(String entityClass)
      Returns the underlying Hibernate metadata about a given entity class across all available persistence units
      Parameters:
      entityClass - FQN of a Hibernate entity
      Returns:
      the Hibernate metadata for that class, or null if there is no mapping
    • getPropertyNames

      @NonNull public static List<String> getPropertyNames(String entityClass)
      Retrieve the names of all of the Hibernate mapped properties for the given entityClass
      Parameters:
      entityClass - mapped class
      Returns:
      all property names or empty list if the class is not mapped by Hibernate or has no properties
      See Also:
    • getPropertyTypes

      @NonNull public static List<org.hibernate.type.Type> getPropertyTypes(String entityClass)
      Retrieve all of the types of all of the Hibernate mapped properties for the given entityClass
      Parameters:
      entityClass - mapped class
      Returns:
      all property types or empty list if the class is not mapped by Hibernate or has no properties
      See Also:
    • getAllMappings

      @NonNull public static Collection<org.hibernate.mapping.PersistentClass> getAllMappings()
      Retrieves all Hibernate metadata for all entities
      Returns:
      all of the tracked PersistentClass across all registered persistence units
    • getSessionFactoryBuilder

      public org.hibernate.boot.SessionFactoryBuilder getSessionFactoryBuilder(org.hibernate.boot.spi.MetadataImplementor metadata, org.hibernate.boot.spi.SessionFactoryBuilderImplementor defaultBuilder)
      Specified by:
      getSessionFactoryBuilder in interface org.hibernate.boot.spi.SessionFactoryBuilderFactory