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 Summary
ConstructorsConstructorDescriptionHibernateMappingProvider
(Map<String, org.hibernate.mapping.PersistentClass> metadataMap) Initialize with seed data independent ofgetSessionFactoryBuilder(MetadataImplementor, SessionFactoryBuilderImplementor)
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<org.hibernate.mapping.PersistentClass>
Retrieves all Hibernate metadata for all entitiesstatic org.hibernate.mapping.PersistentClass
getMapping
(String entityClass) Returns the underlying Hibernate metadata about a given entity class across all available persistence unitsgetPropertyNames
(String entityClass) Retrieve the names of all of the Hibernate mapped properties for the given entityClassstatic List<org.hibernate.type.Type>
getPropertyTypes
(String entityClass) Retrieve all of the types of all of the Hibernate mapped properties for the given entityClassorg.hibernate.boot.SessionFactoryBuilder
getSessionFactoryBuilder
(org.hibernate.boot.spi.MetadataImplementor metadata, org.hibernate.boot.spi.SessionFactoryBuilderImplementor defaultBuilder)
-
Constructor Details
-
HibernateMappingProvider
public HibernateMappingProvider() -
HibernateMappingProvider
Initialize with seed data independent ofgetSessionFactoryBuilder(MetadataImplementor, SessionFactoryBuilderImplementor)
- Parameters:
metadataMap
- seed data
-
-
Method Details
-
getMapping
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
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
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
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 interfaceorg.hibernate.boot.spi.SessionFactoryBuilderFactory
-