Search in sources :

Example 26 with ClassLoadingException

use of org.hibernate.boot.registry.classloading.spi.ClassLoadingException in project hibernate-orm by hibernate.

the class DefaultIdentifierGeneratorFactory method getIdentifierGeneratorClass.

@Override
public Class getIdentifierGeneratorClass(String strategy) {
    if ("hilo".equals(strategy)) {
        throw new UnsupportedOperationException("Support for 'hilo' generator has been removed");
    }
    String resolvedStrategy = "native".equals(strategy) ? getDialect().getNativeIdentifierGeneratorStrategy() : strategy;
    Class generatorClass = generatorStrategyToClassNameMap.get(resolvedStrategy);
    try {
        if (generatorClass == null) {
            final ClassLoaderService cls = serviceRegistry.getService(ClassLoaderService.class);
            generatorClass = cls.classForName(resolvedStrategy);
        }
    } catch (ClassLoadingException e) {
        throw new MappingException(String.format("Could not interpret id generator strategy [%s]", strategy));
    }
    return generatorClass;
}
Also used : ClassLoadingException(org.hibernate.boot.registry.classloading.spi.ClassLoadingException) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService) MappingException(org.hibernate.MappingException)

Aggregations

ClassLoadingException (org.hibernate.boot.registry.classloading.spi.ClassLoadingException)26 Element (org.dom4j.Element)10 AnnotationException (org.hibernate.AnnotationException)10 AnnotatedElement (java.lang.reflect.AnnotatedElement)9 IdClass (javax.persistence.IdClass)9 MapKeyClass (javax.persistence.MapKeyClass)9 ArrayList (java.util.ArrayList)8 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)7 ClassLoaderService (org.hibernate.boot.registry.classloading.spi.ClassLoaderService)7 List (java.util.List)5 MappingException (org.hibernate.MappingException)5 HibernateException (org.hibernate.HibernateException)3 AccessibleObject (java.lang.reflect.AccessibleObject)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 NamedNativeQuery (javax.persistence.NamedNativeQuery)2 NamedQuery (javax.persistence.NamedQuery)2 NamedStoredProcedureQuery (javax.persistence.NamedStoredProcedureQuery)2 Attribute (org.dom4j.Attribute)2