Search in sources :

Example 6 with ClassLoadingException

use of org.hibernate.annotations.common.reflection.ClassLoadingException in project hibernate-orm by hibernate.

the class CallbackBuilderLegacyImpl method buildCallbacksForEntity.

@Override
public void buildCallbacksForEntity(String entityClassName, CallbackRegistrar callbackRegistrar) {
    try {
        final XClass entityXClass = reflectionManager.classForName(entityClassName);
        final Class entityClass = reflectionManager.toClass(entityXClass);
        for (CallbackType callbackType : CallbackType.values()) {
            if (callbackRegistrar.hasRegisteredCallbacks(entityClass, callbackType)) {
                // this most likely means we have a class mapped multiple times using the hbm.xml
                // "entity name" feature
                log.debugf("CallbackRegistry reported that Class [%s] already had %s callbacks registered; " + "assuming this means the class was mapped twice " + "(using hbm.xml entity-name support) - skipping subsequent registrations", entityClassName, callbackType.getCallbackAnnotation().getSimpleName());
                continue;
            }
            final Callback[] callbacks = resolveCallbacks(entityXClass, callbackType, reflectionManager);
            callbackRegistrar.registerCallbacks(entityClass, callbacks);
        }
    } catch (ClassLoadingException e) {
        throw new MappingException("entity class not found: " + entityClassName, e);
    }
}
Also used : Callback(org.hibernate.jpa.event.spi.jpa.Callback) CallbackType(org.hibernate.jpa.event.spi.jpa.CallbackType) ClassLoadingException(org.hibernate.annotations.common.reflection.ClassLoadingException) XClass(org.hibernate.annotations.common.reflection.XClass) XClass(org.hibernate.annotations.common.reflection.XClass) MappingException(org.hibernate.MappingException)

Example 7 with ClassLoadingException

use of org.hibernate.annotations.common.reflection.ClassLoadingException in project hibernate-orm by hibernate.

the class AnnotationsMetadataReader method getAuditData.

public ClassAuditingData getAuditData() {
    if (pc.getClassName() == null) {
        return auditData;
    }
    try {
        final XClass xclass = reflectionManager.classForName(pc.getClassName());
        final ModificationStore defaultStore = getDefaultAudited(xclass);
        if (defaultStore != null) {
            auditData.setDefaultAudited(true);
        }
        new AuditedPropertiesReader(defaultStore, new PersistentClassPropertiesSource(xclass), auditData, globalCfg, reflectionManager, "").read();
        addAuditTable(xclass);
        addAuditSecondaryTables(xclass);
    } catch (ClassLoadingException e) {
        throw new MappingException(e);
    }
    return auditData;
}
Also used : ClassLoadingException(org.hibernate.annotations.common.reflection.ClassLoadingException) ModificationStore(org.hibernate.envers.ModificationStore) XClass(org.hibernate.annotations.common.reflection.XClass) MappingException(org.hibernate.MappingException)

Aggregations

ClassLoadingException (org.hibernate.annotations.common.reflection.ClassLoadingException)7 XClass (org.hibernate.annotations.common.reflection.XClass)6 MappingException (org.hibernate.MappingException)4 AnnotationException (org.hibernate.AnnotationException)2 AssertionFailure (org.hibernate.AssertionFailure)2 PersistentClass (org.hibernate.mapping.PersistentClass)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 MapKeyClass (javax.persistence.MapKeyClass)1 SequenceGenerator (javax.persistence.SequenceGenerator)1 TableGenerator (javax.persistence.TableGenerator)1 Document (org.dom4j.Document)1 XPackage (org.hibernate.annotations.common.reflection.XPackage)1 XProperty (org.hibernate.annotations.common.reflection.XProperty)1 IdentifierGeneratorDefinition (org.hibernate.boot.model.IdentifierGeneratorDefinition)1 TypeDefinition (org.hibernate.boot.model.TypeDefinition)1 AccessType (org.hibernate.cfg.AccessType)1 AnnotatedClassType (org.hibernate.cfg.AnnotatedClassType)1 CollectionPropertyHolder (org.hibernate.cfg.CollectionPropertyHolder)1