Search in sources :

Example 1 with JaxbConverter

use of org.hibernate.boot.jaxb.mapping.spi.JaxbConverter in project hibernate-orm by hibernate.

the class XMLContext method setLocalAttributeConverterDefinitions.

@SuppressWarnings("unchecked")
private void setLocalAttributeConverterDefinitions(List<JaxbConverter> converterElements, String packageName) {
    for (JaxbConverter converterElement : converterElements) {
        final String className = converterElement.getClazz();
        final boolean autoApply = Boolean.TRUE.equals(converterElement.isAutoApply());
        try {
            final Class<? extends AttributeConverter> attributeConverterClass = classLoaderAccess.classForName(buildSafeClassName(className, packageName));
            converterDescriptors.add(new ClassBasedConverterDescriptor(attributeConverterClass, autoApply, classmateContext));
        } catch (ClassLoadingException e) {
            throw new AnnotationException("Unable to locate specified AttributeConverter implementation class : " + className, e);
        } catch (Exception e) {
            throw new AnnotationException("Unable to instantiate specified AttributeConverter implementation class : " + className, e);
        }
    }
}
Also used : JaxbConverter(org.hibernate.boot.jaxb.mapping.spi.JaxbConverter) ClassBasedConverterDescriptor(org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor) ClassLoadingException(org.hibernate.boot.registry.classloading.spi.ClassLoadingException) AnnotationException(org.hibernate.AnnotationException) AnnotationException(org.hibernate.AnnotationException) ClassLoadingException(org.hibernate.boot.registry.classloading.spi.ClassLoadingException)

Example 2 with JaxbConverter

use of org.hibernate.boot.jaxb.mapping.spi.JaxbConverter in project quarkus by quarkusio.

the class JpaJandexScavenger method enlistOrmXmlMapping.

private void enlistOrmXmlMapping(Collector collector, JaxbEntityMappings mapping) {
    String packageName = mapping.getPackage();
    String packagePrefix = packageName == null ? "" : packageName + ".";
    JaxbPersistenceUnitMetadata metadata = mapping.getPersistenceUnitMetadata();
    JaxbPersistenceUnitDefaults defaults = metadata == null ? null : metadata.getPersistenceUnitDefaults();
    if (defaults != null) {
        enlistOrmXmlMappingListeners(collector, packagePrefix, defaults.getEntityListeners());
    }
    for (JaxbEntity entity : mapping.getEntity()) {
        enlistOrmXmlMappingManagedClass(collector, packagePrefix, entity, "entity");
    }
    for (JaxbMappedSuperclass mappedSuperclass : mapping.getMappedSuperclass()) {
        enlistOrmXmlMappingManagedClass(collector, packagePrefix, mappedSuperclass, "mapped-superclass");
    }
    for (JaxbEmbeddable embeddable : mapping.getEmbeddable()) {
        String name = safeGetClassName(packagePrefix, embeddable, "embeddable");
        enlistExplicitClass(collector, name);
    }
    for (JaxbConverter converter : mapping.getConverter()) {
        collector.potentialCdiBeanTypes.add(DotName.createSimple(qualifyIfNecessary(packagePrefix, converter.getClazz())));
    }
}
Also used : JaxbConverter(org.hibernate.boot.jaxb.mapping.spi.JaxbConverter) JaxbMappedSuperclass(org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclass) JaxbEmbeddable(org.hibernate.boot.jaxb.mapping.spi.JaxbEmbeddable) JaxbPersistenceUnitDefaults(org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitDefaults) JaxbPersistenceUnitMetadata(org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitMetadata) JaxbEntity(org.hibernate.boot.jaxb.mapping.spi.JaxbEntity)

Aggregations

JaxbConverter (org.hibernate.boot.jaxb.mapping.spi.JaxbConverter)2 AnnotationException (org.hibernate.AnnotationException)1 JaxbEmbeddable (org.hibernate.boot.jaxb.mapping.spi.JaxbEmbeddable)1 JaxbEntity (org.hibernate.boot.jaxb.mapping.spi.JaxbEntity)1 JaxbMappedSuperclass (org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclass)1 JaxbPersistenceUnitDefaults (org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitDefaults)1 JaxbPersistenceUnitMetadata (org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitMetadata)1 ClassBasedConverterDescriptor (org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor)1 ClassLoadingException (org.hibernate.boot.registry.classloading.spi.ClassLoadingException)1