Interface DynamicDaoHelper
- All Known Implementing Classes:
DynamicDaoHelperImpl
public interface DynamicDaoHelper
Provides utility methods for interacting with dynamic entities
- Author:
- Andre Azzolini (apazzolini), Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>[]
getAllPolymorphicEntitiesFromCeiling
(Class<?> ceilingClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache) Get all the polymorphic types known to Hibernate for the ceiling class provided.getIdentifier
(Object entity) The value of the Hibernate registered identifier property for the entity instance.getIdField
(Class<?> clazz) The Field that represents the Hibernate registered identifier property for the entity class.getIdMetadata
(Class<?> entityClass, jakarta.persistence.EntityManager entityManager) Retrieve information about the id property for the entity class and the data type of that property.getPropertyNames
(Class<?> entityClass) Retrieve the list of property names known to Hibernate for the entity class.List<org.hibernate.type.Type>
getPropertyTypes
(Class<?> entityClass) Retrieve the list of property types (Type
known to Hibernate for the entity class.Class<?>[]
getUpDownInheritance
(Class<?> testClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache) Retrieve a complete polymorphic type list for an entity class, even if the entity class is not the ceiling class (or root of the hierarchy).boolean
isExcludeClassFromPolymorphism
(Class<?> clazz) Discover is a class should be excluded from a polymorphic list.Class<?>[]
sortEntities
(Class<?> ceilingClass, List<Class<?>> entities) Sort a list of polymorphic types with the most derived appearing first.
-
Method Details
-
getIdMetadata
Map<String,Object> getIdMetadata(Class<?> entityClass, jakarta.persistence.EntityManager entityManager) Retrieve information about the id property for the entity class and the data type of that property. This will return a Map containing two members. The first will be keyed with the String "name" and will be the name of the id property on the entity class. The second will be keyed with the String "type" and will be the HibernateType
instance for the property (e.g.LongType
).- Parameters:
entityClass
-entityManager
-- Returns:
-
getPropertyNames
Retrieve the list of property names known to Hibernate for the entity class.- Parameters:
entityClass
-- Returns:
-
getPropertyTypes
Retrieve the list of property types (Type
known to Hibernate for the entity class.- Parameters:
entityClass
-- Returns:
-
getAllPolymorphicEntitiesFromCeiling
Class<?>[] getAllPolymorphicEntitiesFromCeiling(Class<?> ceilingClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache) Get all the polymorphic types known to Hibernate for the ceiling class provided. The ceiling class should be an entity class registered in Hibernate (or a specific interface unique to that entity class). The returned array is sorted with the most derived entities appearing first in the list.- Parameters:
ceilingClass
-includeUnqualifiedPolymorphicEntities
- Some entities may be excluded from polymorphism (Abstract class and those marked withAdminPresentationClass.excludeFromPolymorphism()
). Override that exlusion behavior.useCache
- Cache the polymorphic types discovered for the ceilingClass.- Returns:
- The list of Hibernate registered entities that derive from the ceilingClass (including the ceilingClass)
-
sortEntities
Sort a list of polymorphic types with the most derived appearing first.- Parameters:
ceilingClass
-entities
-- Returns:
-
isExcludeClassFromPolymorphism
Discover is a class should be excluded from a polymorphic list. Exclusion is generally enforced if the class is abstract or if the class is marked withAdminPresentationClass.excludeFromPolymorphism()
.- Parameters:
clazz
-- Returns:
-
getIdentifier
The value of the Hibernate registered identifier property for the entity instance.- Parameters:
entity
-- Returns:
-
getIdField
The Field that represents the Hibernate registered identifier property for the entity class.- Parameters:
clazz
-- Returns:
-
getUpDownInheritance
Class<?>[] getUpDownInheritance(Class<?> testClass, boolean includeUnqualifiedPolymorphicEntities, boolean useCache) Retrieve a complete polymorphic type list for an entity class, even if the entity class is not the ceiling class (or root of the hierarchy). This allows you to possibly provide a mid-level entity class and get back a list of entity classes both above and below the testClass. The type list passed back is ordered with the ceiling class appearing first and the most derived classes appearing last.- Parameters:
testClass
- An entity class to look for polymorphic types both above and belowincludeUnqualifiedPolymorphicEntities
- Some entities may be excluded from polymorphism (Abstract class and those marked withAdminPresentationClass.excludeFromPolymorphism()
). Override that exlusion behavior.useCache
- Cache the polymorphic types discovered for the ceilingClass.- Returns:
- The list of Hibernate registered entities that appear above and below the testClass in an entity inheritance hierarchy
-