Class ClassUtils
java.lang.Object
ch.tocco.nice2.persist.core.api.util.ClassUtils
-
Method Summary
Modifier and TypeMethodDescriptionloadEntityClassByName
(org.hibernate.metamodel.model.domain.JpaMetamodel metamodel, String entityName) Loads the class of an entity by its (simple or fully-qualified) name.
-
Method Details
-
loadEntityClassByName
public static <T extends Entity> Class<T> loadEntityClassByName(org.hibernate.metamodel.model.domain.JpaMetamodel metamodel, String entityName) Loads the class of an entity by its (simple or fully-qualified) name. The class is loaded from theJpaMetamodel
. This is important because these classes are generated during the hibernate initialization - if hibernate is not loaded yet, the class does not exist yet! Getting them from theJpaMetamodel
ensures that hibernate is already initialized. Session-only entities are unknown to hibernate and are loaded directly from the classloader.
-