Search in sources :

Example 1 with XPackage

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

the class AnnotationBinder method bindPackage.

public static void bindPackage(String packageName, MetadataBuildingContext context) {
    XPackage pckg;
    try {
        pckg = context.getBuildingOptions().getReflectionManager().packageForName(packageName);
    } catch (ClassLoadingException e) {
        LOG.packageNotFound(packageName);
        return;
    } catch (ClassNotFoundException cnf) {
        LOG.packageNotFound(packageName);
        return;
    }
    if (pckg.isAnnotationPresent(SequenceGenerator.class)) {
        SequenceGenerator ann = pckg.getAnnotation(SequenceGenerator.class);
        IdentifierGeneratorDefinition idGen = buildIdGenerator(ann, context);
        context.getMetadataCollector().addIdentifierGenerator(idGen);
        if (LOG.isTraceEnabled()) {
            LOG.tracev("Add sequence generator with name: {0}", idGen.getName());
        }
    }
    if (pckg.isAnnotationPresent(TableGenerator.class)) {
        TableGenerator ann = pckg.getAnnotation(TableGenerator.class);
        IdentifierGeneratorDefinition idGen = buildIdGenerator(ann, context);
        context.getMetadataCollector().addIdentifierGenerator(idGen);
    }
    bindGenericGenerators(pckg, context);
    bindQueries(pckg, context);
    bindFilterDefs(pckg, context);
    bindTypeDefs(pckg, context);
    bindFetchProfiles(pckg, context);
    BinderHelper.bindAnyMetaDefs(pckg, context);
}
Also used : ClassLoadingException(org.hibernate.annotations.common.reflection.ClassLoadingException) SequenceGenerator(javax.persistence.SequenceGenerator) IdentifierGeneratorDefinition(org.hibernate.boot.model.IdentifierGeneratorDefinition) XPackage(org.hibernate.annotations.common.reflection.XPackage) TableGenerator(javax.persistence.TableGenerator)

Aggregations

SequenceGenerator (javax.persistence.SequenceGenerator)1 TableGenerator (javax.persistence.TableGenerator)1 ClassLoadingException (org.hibernate.annotations.common.reflection.ClassLoadingException)1 XPackage (org.hibernate.annotations.common.reflection.XPackage)1 IdentifierGeneratorDefinition (org.hibernate.boot.model.IdentifierGeneratorDefinition)1